简体   繁体   中英

Spring security rest plugin for Grails3

The latest spring security rest plugin works only with Grails 2.x. Could someone provide the plugin details for Grails 3.x

Spring Security Rest and it's docs have been updated.

You need to add the following to build.gradle

build.gradle

dependencies {

    //Other dependencies

    compile "org.grails.plugins:spring-security-rest:2.0.0.M2"
}

Next, you need to run Spring Security quickstart

grails s2-quickstart com.yourapp Person Role

Finally, you need to configure the filter chain but adding the following into your application.groovy .

application.groovy

grails.plugin.springsecurity.filterChain.chainMap = [
    //Stateless chain
    [
        pattern: '/api/**',
        filters: 'JOINED_FILTERS,-anonymousAuthenticationFilter,-exceptionTranslationFilter,-authenticationProcessingFilter,-securityContextPersistenceFilter,-rememberMeAuthenticationFilter'
    ],

    //Traditional chain
    [
        pattern: '/**',
        filters: 'JOINED_FILTERS,-restTokenValidationFilter,-restExceptionTranslationFilter'
    ]
]

This answer goes into more depth.

没有与Grails 3.x兼容的Spring Security REST插件。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM