From 1e1860379c431d85280efc8fca01e9d887f35dd3 Mon Sep 17 00:00:00 2001 From: Randall Richard Date: Mon, 28 Mar 2016 13:37:36 -0400 Subject: [PATCH] Add Spring Security REST filters and test endpoint --- grails-app/conf/application.groovy | 8 ++++++-- .../testappsecurityrest/ApplicationController.groovy | 7 +++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/grails-app/conf/application.groovy b/grails-app/conf/application.groovy index b29ce8d..f812b86 100644 --- a/grails-app/conf/application.groovy +++ b/grails-app/conf/application.groovy @@ -14,7 +14,9 @@ grails.plugin.springsecurity.controllerAnnotations.staticRules = [ [pattern: '/**/js/**', access: ['permitAll']], [pattern: '/**/css/**', access: ['permitAll']], [pattern: '/**/images/**', access: ['permitAll']], - [pattern: '/**/favicon.ico', access: ['permitAll']] + [pattern: '/**/favicon.ico', access: ['permitAll']], + [pattern: '/application/index', access: ['permitAll']] + ] grails.plugin.springsecurity.filterChain.chainMap = [ @@ -23,6 +25,8 @@ grails.plugin.springsecurity.filterChain.chainMap = [ [pattern: '/**/css/**', filters: 'none'], [pattern: '/**/images/**', filters: 'none'], [pattern: '/**/favicon.ico', filters: 'none'], - [pattern: '/**', filters: 'JOINED_FILTERS'] + [pattern: '/application/testSecureJSON', filters: 'JOINED_FILTERS,-anonymousAuthenticationFilter,-exceptionTranslationFilter,-authenticationProcessingFilter,-securityContextPersistenceFilter,-rememberMeAuthenticationFilter' ], + [pattern: '/api/**', filters: 'JOINED_FILTERS,-anonymousAuthenticationFilter,-exceptionTranslationFilter,-authenticationProcessingFilter,-securityContextPersistenceFilter,-rememberMeAuthenticationFilter' ], + [pattern: '/**', filters: 'JOINED_FILTERS,-restTokenValidationFilter,-restExceptionTranslationFilter'] ] diff --git a/grails-app/controllers/testappsecurityrest/ApplicationController.groovy b/grails-app/controllers/testappsecurityrest/ApplicationController.groovy index 0ab5e81..221f92e 100644 --- a/grails-app/controllers/testappsecurityrest/ApplicationController.groovy +++ b/grails-app/controllers/testappsecurityrest/ApplicationController.groovy @@ -1,5 +1,6 @@ package testappsecurityrest +import grails.converters.JSON import grails.core.GrailsApplication import grails.util.Environment import grails.plugins.* @@ -12,4 +13,10 @@ class ApplicationController implements PluginManagerAware { def index() { [grailsApplication: grailsApplication, pluginManager: pluginManager] } + + def testSecureJSON() { + def ret = [hello: 'world secure'] + println 'in testJSecureSON ' + params + render ret as JSON + } }