It’s unclear if you’re using Spring MVC or other Spring components, and so 
whether you use Springfox or swagger-core.

Have you looked into the generated spec itself to see that the oauth2 flow is 
included there?

Which version of swagger-ui do you use?

 

 

 

From: <[email protected]> on behalf of Bojan Gašpar 
<[email protected]>
Reply-To: "[email protected]" 
<[email protected]>
Date: Tuesday, 23 August 2016 at 00:58
To: Swagger <[email protected]>
Subject: OAuth2 authorization

 

Hi everyone. I'm having problems with swagger documentation for API endpoints 
which have the @PreAuthorize annotation (we use spring framework and OAuth2 for 
authorization). When I click "Try it out!" I get a 403 response (forbidden). I 
was trying to use the @Authorization and @AuthorizationScope annotations but 
without any luck.  

 

Can I perform the authorization somehow or at least is there a way to detect 
that an endpoint needs authorization so that I can mark that endpoint in the 
documentation?

 

This is how I used the annotations: 

@ApiOperation(value = "Value", authorizations = { @Authorization("ADMIN") })

@PreAuthorize("isAuthenticated()")

 

...but the response was the same.

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to