Spring-oauth-server Practice (2-1) problem clarification-about resources, roles, and scope

Source: Internet
Author: User
Tags oauth

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.