El1057e:no Bean Resolver Registered in the context to resolve access to bean ' permissionservice '

Source: Internet
Author: User

https://github.com/spring-projects/spring-security-oauth/issues/730

@Slf4j @Component ("Permissionservice") public class Uacpermissionserviceimpl implements uacpermissionservice{private
    Antpathmatcher antpathmatcher = new Antpathmatcher (); @Override public boolean haspermission (authentication authentication, HttpServletRequest request) {String cur
        Rentloginname = Securityutils.getcurrentloginname ();
        set<string> Currentauthorityurl = Securityutils.getcurrentauthorityurl ();
        String RequestUri = Request.getrequesturi (); Log.info ("Verify Permissions loginname={}, requesturi={}, hasauthorityurl={}", Currentloginname, RequestUri, Joiner.on (","). Join (

        Currentauthorityurl));
        if (Stringutils.equals (Currentloginname, GlobalConstant.Sys.SUPER_MANAGER_LOGIN_NAME)) {return true; } for (final String Authority:currentauthorityurl) {//Demo project leave query permission if (Requesturi.con Tains ("query") | | Requesturi.contains ("get") | | Requesturi.contains ("check") | | Requesturi.contains ("Select")) {return true;
            } if (Antpathmatcher.match (authority, RequestUri)) {return true;
    }} return false; }
}
 @Order @Component public class Pcpermissionauthorizeconfigprovider implements
     Authorizeconfigprovider {/** * Config Boolean. * * @param config the config * * @return the Boolean */@Override public boolean config (expres Sionurlauthorizationconfigurer
@Configuration public
class Pcsecurityexpressionhandler extends Oauth2websecurityexpressionhandler {
    @Bean Public
    Oauth2websecurityexpressionhandler Oauth2websecurityexpressionhandler (applicationcontext ApplicationContext) {
        Oauth2websecurityexpressionhandler Expressionhandler = new Oauth2websecurityexpressionhandler ();
        Expressionhandler.setapplicationcontext (ApplicationContext);
        return expressionhandler;
    }
}
@Configuration
@EnableResourceServer Public
class Pcresourceserverconfig extends Resourceserverconfigureradapter {
    @Override public
    void Configure (Resourceserversecurityconfigurer Resources) {
        resources.expressionhandler (pcsecurityexpressionhandler);
    }
}

Take a moment to record it later.

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.