Not really. It needs CORS for every URI it hits. Refresh is a different URI from the code->token exchange one it uses initially.
When Keycloak redirects back to the GWT app and the code is exchanged for the tokens, I see this in the Network trace:
First an OPTIONS request:
Remote Address:
Request URL:
Request Method:
OPTIONS
Status Code:
200 OK
- Request Headersview source
Accept:
*/*
Accept-Encoding:
gzip, deflate, sdch
Accept-Language:
en-US,en;q=0.8
Access-Control-Request-Headers:
authorization, content-type
Access-Control-Request-Method:
POST
Connection:
keep-alive
Host:
localhost:8080
Origin:
Referer:
User-Agent:
Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36
- Response Headersview source
Access-Control-Allow-Credentials:
true
Access-Control-Allow-Headers:
Origin, Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers, Authorization
Access-Control-Allow-Methods:
GET, HEAD, OPTIONS
Access-Control-Allow-Origin:
Access-Control-Max-Age:
3600
Connection:
keep-alive
Content-Length:
0
Date:
Tue, 02 Dec 2014 14:51:47 GMT
Server:
WildFly/8
X-Powered-By:
Undertow/1
Then the actual code exchange request:
Remote Address:
Request URL:
Request Method:
POST
Status Code:
200 OK
- Request Headersview source
Accept:
*/*
Accept-Encoding:
gzip, deflate
Accept-Language:
en-US,en;q=0.8
Authorization:
Basic R2FtZVNlZWRlcjoyYTczYTQ0Yi1lMGFhLTRiMTYtODk2OC1hY2YwZTVlMGVlNTk=
Connection:
keep-alive
Content-Length:
85
Content-type:
application/x-www-form-urlencoded
Cookie:
KEYCLOAK_IDENTITY=eyJhbGciOiJSUzI1NiJ9.eyJqdGkiOiI5NTA4ZTg2Yi04ZjdhLTRmN2UtOWYzOC1jMTFhMDdkNjUyOWMiLCJleHAiOjE0MjAxMjM5MDYsIm5iZiI6MCwiaWF0IjoxNDE3NTMxOTA2LCJpc3MiOiJHYW1lU2VlZGVyIiwic3ViIjoiOTY0ZjkwNWMtZTg2ZC00NDUzLWE3MzItYWVlMDE5NGY5YTIwIiwic2Vzc2lvbl9zdGF0ZSI6ImVjODE0NjcyLTFhOWYtNDM1ZS04YjU4LTU4ZmI4MDNiMDZkYSIsInJlc291cmNlX2FjY2VzcyI6e319.LiS51MggFZVPJ-TUlcYejPD7x6pJvgdOYCLrHV8LKiIP6BGZzS7D4W0t3xsXeKxqBr-h3cSaY_BqWKRl4RGn67SHuWvoDRrS6xKPZuWPQ08NS_iQVrIKGOATtGF2VFMutnroa4Y_UNmi5T2gZFc-wphRWRV5YG-x-DGAqd4h42U; KEYCLOAK_SESSION=GameSeeder/964f905c-e86d-4453-a732-aee0194f9a20/ec814672-1a9f-435e-8b58-58fb803b06da; KEYCLOAK_REMEMBER_ME=username:alain
Host:
localhost:8080
Origin:
Referer:
User-Agent:
Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36
- Form Dataview sourceview URL encoded
code:
sCnqEAuF8YuobscjJnCKdGu6xqnZ-CsqT5prXc5i7os.b9cda44e-50d6-49dd-b30a-dee68b530662
- Response Headersview source
Access-Control-Allow-Credentials:
true
Access-Control-Allow-Headers:
Origin, Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers, Authorization
Access-Control-Allow-Methods:
POST
Access-Control-Allow-Origin:
Access-Control-Expose-Headers:
Access-Control-Allow-Methods
Access-Control-Max-Age:
3600
Connection:
keep-alive
Content-Type:
application/json
Date:
Tue, 02 Dec 2014 14:51:47 GMT
Server:
WildFly/8
Transfer-Encoding:
chunked
X-Powered-By:
Undertow/1
Now I wait 5+ minutes, forcing keycloak to use the refresh token. Since this uses the refresh URI for the first time, Chrome performs a preflight check: