Skip to content

Instantly share code, notes, and snippets.

@sebastienblanc
Last active December 20, 2015 12:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sebastienblanc/6133102 to your computer and use it in GitHub Desktop.
Save sebastienblanc/6133102 to your computer and use it in GitHub Desktop.

My app is using ag-sec and the @secure annotation.

Scenario: hitting secured endpoints without CORS (webapp deployed in the same domain)

When the user has not the role specified by @secure I got an exception, as expected https://gist.github.com/sebastienblanc/6134149

I assume it is because of this https://github.com/aerogear/aerogear-security/blob/master/src/main/java/org/jboss/aerogear/security/interceptor/SecurityInterceptor.java#L71 and perfect works as designed.

And without CORS, the server returns a nice 401 status to the client.

Testing in a CORS configuration (web client running under another domain)

Same scenario I'm hitting a secure role without having the role needed (BTW the OPTIONS preflights are handled without any errors).

I'm getting the same exception from the server but this time no proper 401 answer sent back to the client, and on client side the request is just canceled.

  1. Reproduce it To repoduce this scenario here are the step :

So, Whan I'm looking for is to have a normal 401 status sent back to the client when using CORS, maybe someone has some ides about this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment