Oauth_client_details-----resource_ids------Scope
User_------previllage (role)
Explanation of the resources
Https://andaily.com/blog/?cat=19
Resource is used to group management of various resources provided by the system, each resource corresponds to a resource-id, and a client details must have at least one resource-id ( Corresponds to the Resourceids field in the Oauthclientdetails.java).
In the spring-oauth-server of the Security.xml profile of the 70 lines, you will see two lines of configuration, as follows:
<!--Unity Resource server Filter--><oauth2:resource-server id= "Unityresourceserver" resource-id= " Unity-resource "token-services-ref=" tokenservices "/><!--Mobile Resource Server filter--><oauth2: Resource-server id= "Mobileresourceserver" resource-id= "Mobile-resource" token-services-ref= "TokenServices"/>
Here is the place to configure resource, see the inside of the two Resource-id values.
On this configuration, you can see two
With the above basis, and see below we want to add a own RESOURCE, assuming resource-id = MyResource, URL pattern is/my/api/**, the permission is Role_my_resource, scope is read; It is configured as follows:
1. Add <oauth2:resource-server>, Resource-id=myresource, as follows:
<oauth2:resource-server id= "Myresourceserver" resource-id= "MyResource" token-services-ref= "TokenServices"/>
Note that the ID value requires a unique
2. Add
Description: A <resource-server> can be configured with multiple
OK, configuration complete, new Resource:myresource; At this time, all URL requests beginning with/my/api/** will be protected by OAUTH2, and the client details are created in the business, remember to set Resourceids to MyResource, and to have Role_my_ The permissions of the resource.
Spring-oauth-server Practice (2-1) problem clarification-about resources, roles, and scope