Grails3Spring安全LDAP插件和Tomcat8

Grails3Spring安全LDAP插件和Tomcat8,tomcat,grails,spring-security,spring-boot,Tomcat,Grails,Spring Security,Spring Boot,我有一个外部YML文件,其中包含一些grails配置。在这个文件中,添加的配置之一是GrailsSpringSecurityLDAP插件。我的配置如下所示: --- grails: plugin: springsecurity: ldap: context: managerDn: 'uid=admin,ou=system' manager

我有一个外部YML文件,其中包含一些grails配置。在这个文件中,添加的配置之一是GrailsSpringSecurityLDAP插件。我的配置如下所示:

---
grails:
    plugin:
        springsecurity:
            ldap:
                context:
                    managerDn: 'uid=admin,ou=system'
                    managerPassword: 'secret'
                    server: 'ldap://localhost:10389'
                authorities:
                    groupSearchBase: 'ou=Groups,dc=c3cen,dc=com'
                    retreiveGroupRoles: true
                    retreiveDatabaseRoles: false
                    groupSearchFilter: 'member={0}'
                search:
                    base: 'ou=Users,dc=c3cen,dc=com'
            password:
                algoritham: 'SHA-256'
            interceptUrlMap: [
                {pattern: '/',               access: ['permitAll']},
                {pattern: '/error',          access: ['permitAll']},
                {pattern: '/index',          access: ['permitAll']},
                {pattern: '/index.gsp',      access: ['permitAll']},
                {pattern: '/shutdown',       access: ['permitAll']},
                {pattern: '/assets/**',      access: ['permitAll']},
                {pattern: '/**/js/**',       access: ['permitAll']},
                {pattern: '/**/css/**',      access: ['permitAll']},
                {pattern: '/**/images/**',   access: ['permitAll']},
                {pattern: '/**/favicon.ico', access: ['permitAll']},
                {pattern: '/login/**',       access: ['permitAll']},
                {pattern: '/logout/**',      access: ['permitAll']}
            ]
---
    @Override
    void setEnvironment(Environment environment) {
        try {
            String configPath = System.getenv("local.config.location")
            def ymlConfig = new File(configPath)
            Resource resourceConfig = new FileSystemResource(ymlConfig)
            YamlPropertiesFactoryBean ypfb = new YamlPropertiesFactoryBean()
            ypfb.setResources(resourceConfig)
            ypfb.afterPropertiesSet()
            Properties properties = ypfb.getObject()
            environment.propertySources.addFirst(new PropertiesPropertySource("local.config.location", properties))
        } catch (Exception e) {
            log.error("unable to load the external configuration file", e)
        }
    }
@Override
void setEnvironment(Environment environment) {
    try {
        String configPath = System.getenv("local.config.location")
        def configFile = new File(configPath)
        def config = new ConfigSlurper().parse(configFile.toURI().toURL())
        environment.propertySources.addFirst(new MapPropertySource("externalGroovyConfig", config))
    } catch (Exception e) {
        log.error("unable to load the external configuration file", e)
    }
}
grails.plugin.springsecurity.ldap.context.managerDn = 'uid=admin,ou=system'
grails.plugin.springsecurity.ldap.context.managerPassword = 'secret'
grails.plugin.springsecurity.ldap.context.server = 'ldap://localhost:10389/'
grails.plugin.springsecurity.ldap.authorities.groupSearchBase = 'ou=Groups,dc=c3cen,dc=com'
grails.plugin.springsecurity.ldap.authorities.retreiveGroupRoles = true
grails.plugin.springsecurity.ldap.authorities.retreiveDatabaseRoles = false
grails.plugin.springsecurity.ldap.authorities.groupSearchFilter = 'member={0}'
grails.plugin.springsecurity.ldap.search.base = 'ou=Users,dc=c3cen,dc=com'

grails.plugin.springsecurity.password.algoritham = 'SHA-256'

grails.plugin.springsecurity.controllerAnnotations.staticRules = [
    [pattern: '/',               access: ['permitAll']],
    [pattern: '/error',          access: ['permitAll']],
    [pattern: '/index',          access: ['permitAll']],
    [pattern: '/index.gsp',      access: ['permitAll']],
    [pattern: '/shutdown',       access: ['permitAll']],
    [pattern: '/assets/**',      access: ['permitAll']],
    [pattern: '/**/js/**',       access: ['permitAll']],
    [pattern: '/**/css/**',      access: ['permitAll']],
    [pattern: '/**/images/**',   access: ['permitAll']],
    [pattern: '/**/favicon.ico', access: ['permitAll']]
]

grails.plugin.springsecurity.filterChain.chainMap = [
    [pattern: '/assets/**',      filters: 'none'],
    [pattern: '/**/js/**',       filters: 'none'],
    [pattern: '/**/css/**',      filters: 'none'],
    [pattern: '/**/images/**',   filters: 'none'],
    [pattern: '/**/favicon.ico', filters: 'none'],
    [pattern: '/**',             filters: 'JOINED_FILTERS']
]
我在常规(由grails quick config提供)应用程序yml文件中也有一些属性。此文件仅包含:

grails:
    plugin:
        springsecurity:
            securityConfigType: 'InterceptUrlMap'
            providerNames: ['ldapAuthProvider', 'anonymousAuthenticationProvider']
我通过重写Application.groovy类中的setEnvironment方法在grails中加载外部配置。情况如下:

---
grails:
    plugin:
        springsecurity:
            ldap:
                context:
                    managerDn: 'uid=admin,ou=system'
                    managerPassword: 'secret'
                    server: 'ldap://localhost:10389'
                authorities:
                    groupSearchBase: 'ou=Groups,dc=c3cen,dc=com'
                    retreiveGroupRoles: true
                    retreiveDatabaseRoles: false
                    groupSearchFilter: 'member={0}'
                search:
                    base: 'ou=Users,dc=c3cen,dc=com'
            password:
                algoritham: 'SHA-256'
            interceptUrlMap: [
                {pattern: '/',               access: ['permitAll']},
                {pattern: '/error',          access: ['permitAll']},
                {pattern: '/index',          access: ['permitAll']},
                {pattern: '/index.gsp',      access: ['permitAll']},
                {pattern: '/shutdown',       access: ['permitAll']},
                {pattern: '/assets/**',      access: ['permitAll']},
                {pattern: '/**/js/**',       access: ['permitAll']},
                {pattern: '/**/css/**',      access: ['permitAll']},
                {pattern: '/**/images/**',   access: ['permitAll']},
                {pattern: '/**/favicon.ico', access: ['permitAll']},
                {pattern: '/login/**',       access: ['permitAll']},
                {pattern: '/logout/**',      access: ['permitAll']}
            ]
---
    @Override
    void setEnvironment(Environment environment) {
        try {
            String configPath = System.getenv("local.config.location")
            def ymlConfig = new File(configPath)
            Resource resourceConfig = new FileSystemResource(ymlConfig)
            YamlPropertiesFactoryBean ypfb = new YamlPropertiesFactoryBean()
            ypfb.setResources(resourceConfig)
            ypfb.afterPropertiesSet()
            Properties properties = ypfb.getObject()
            environment.propertySources.addFirst(new PropertiesPropertySource("local.config.location", properties))
        } catch (Exception e) {
            log.error("unable to load the external configuration file", e)
        }
    }
@Override
void setEnvironment(Environment environment) {
    try {
        String configPath = System.getenv("local.config.location")
        def configFile = new File(configPath)
        def config = new ConfigSlurper().parse(configFile.toURI().toURL())
        environment.propertySources.addFirst(new MapPropertySource("externalGroovyConfig", config))
    } catch (Exception e) {
        log.error("unable to load the external configuration file", e)
    }
}
grails.plugin.springsecurity.ldap.context.managerDn = 'uid=admin,ou=system'
grails.plugin.springsecurity.ldap.context.managerPassword = 'secret'
grails.plugin.springsecurity.ldap.context.server = 'ldap://localhost:10389/'
grails.plugin.springsecurity.ldap.authorities.groupSearchBase = 'ou=Groups,dc=c3cen,dc=com'
grails.plugin.springsecurity.ldap.authorities.retreiveGroupRoles = true
grails.plugin.springsecurity.ldap.authorities.retreiveDatabaseRoles = false
grails.plugin.springsecurity.ldap.authorities.groupSearchFilter = 'member={0}'
grails.plugin.springsecurity.ldap.search.base = 'ou=Users,dc=c3cen,dc=com'

grails.plugin.springsecurity.password.algoritham = 'SHA-256'

grails.plugin.springsecurity.controllerAnnotations.staticRules = [
    [pattern: '/',               access: ['permitAll']],
    [pattern: '/error',          access: ['permitAll']],
    [pattern: '/index',          access: ['permitAll']],
    [pattern: '/index.gsp',      access: ['permitAll']],
    [pattern: '/shutdown',       access: ['permitAll']],
    [pattern: '/assets/**',      access: ['permitAll']],
    [pattern: '/**/js/**',       access: ['permitAll']],
    [pattern: '/**/css/**',      access: ['permitAll']],
    [pattern: '/**/images/**',   access: ['permitAll']],
    [pattern: '/**/favicon.ico', access: ['permitAll']]
]

grails.plugin.springsecurity.filterChain.chainMap = [
    [pattern: '/assets/**',      filters: 'none'],
    [pattern: '/**/js/**',       filters: 'none'],
    [pattern: '/**/css/**',      filters: 'none'],
    [pattern: '/**/images/**',   filters: 'none'],
    [pattern: '/**/favicon.ico', filters: 'none'],
    [pattern: '/**',             filters: 'JOINED_FILTERS']
]
当我在grails中发出runapp命令并部署到我的嵌入式tocat时,一切都按预期工作。当我手动部署到本地tomcat时,firefox中会出现“页面未正确重定向”错误

注意:我已经用日志语句确认两个tomcat服务器都在读取外部文件。奇怪的是,属性被注入,但它们被默认提供的字符串覆盖。例如:dc=example显示在search.base中,但在我上面的代码中,您可以清楚地看到它位于“ou=Users,dc=c3cen,dc=com”中。注意,这两个属性都存在,但我猜默认值会覆盖自定义属性


在本地(非嵌入grails的)Tomcat服务器上是否还有其他需要更改的内容,以允许外部属性工作?我尝试更改application.yml(外部文件)的位置,但没有成功。

我注意到这里的奇怪之处是,interceptUrlMap是唯一一个未能从外部yml文件加载的调用。因为这是当时文档中唯一提供的用于静态路由的方法,所以我选择了不同的路由。(使用外部groovy配置,而不是yml配置)

下面是我为使用LDAP插件进行外部配置所做的工作列表。首先,我确保我的应用程序启动运行类(application.groovy)实现了环境感知。我将SetEnvironment方法改写为:

---
grails:
    plugin:
        springsecurity:
            ldap:
                context:
                    managerDn: 'uid=admin,ou=system'
                    managerPassword: 'secret'
                    server: 'ldap://localhost:10389'
                authorities:
                    groupSearchBase: 'ou=Groups,dc=c3cen,dc=com'
                    retreiveGroupRoles: true
                    retreiveDatabaseRoles: false
                    groupSearchFilter: 'member={0}'
                search:
                    base: 'ou=Users,dc=c3cen,dc=com'
            password:
                algoritham: 'SHA-256'
            interceptUrlMap: [
                {pattern: '/',               access: ['permitAll']},
                {pattern: '/error',          access: ['permitAll']},
                {pattern: '/index',          access: ['permitAll']},
                {pattern: '/index.gsp',      access: ['permitAll']},
                {pattern: '/shutdown',       access: ['permitAll']},
                {pattern: '/assets/**',      access: ['permitAll']},
                {pattern: '/**/js/**',       access: ['permitAll']},
                {pattern: '/**/css/**',      access: ['permitAll']},
                {pattern: '/**/images/**',   access: ['permitAll']},
                {pattern: '/**/favicon.ico', access: ['permitAll']},
                {pattern: '/login/**',       access: ['permitAll']},
                {pattern: '/logout/**',      access: ['permitAll']}
            ]
---
    @Override
    void setEnvironment(Environment environment) {
        try {
            String configPath = System.getenv("local.config.location")
            def ymlConfig = new File(configPath)
            Resource resourceConfig = new FileSystemResource(ymlConfig)
            YamlPropertiesFactoryBean ypfb = new YamlPropertiesFactoryBean()
            ypfb.setResources(resourceConfig)
            ypfb.afterPropertiesSet()
            Properties properties = ypfb.getObject()
            environment.propertySources.addFirst(new PropertiesPropertySource("local.config.location", properties))
        } catch (Exception e) {
            log.error("unable to load the external configuration file", e)
        }
    }
@Override
void setEnvironment(Environment environment) {
    try {
        String configPath = System.getenv("local.config.location")
        def configFile = new File(configPath)
        def config = new ConfigSlurper().parse(configFile.toURI().toURL())
        environment.propertySources.addFirst(new MapPropertySource("externalGroovyConfig", config))
    } catch (Exception e) {
        log.error("unable to load the external configuration file", e)
    }
}
grails.plugin.springsecurity.ldap.context.managerDn = 'uid=admin,ou=system'
grails.plugin.springsecurity.ldap.context.managerPassword = 'secret'
grails.plugin.springsecurity.ldap.context.server = 'ldap://localhost:10389/'
grails.plugin.springsecurity.ldap.authorities.groupSearchBase = 'ou=Groups,dc=c3cen,dc=com'
grails.plugin.springsecurity.ldap.authorities.retreiveGroupRoles = true
grails.plugin.springsecurity.ldap.authorities.retreiveDatabaseRoles = false
grails.plugin.springsecurity.ldap.authorities.groupSearchFilter = 'member={0}'
grails.plugin.springsecurity.ldap.search.base = 'ou=Users,dc=c3cen,dc=com'

grails.plugin.springsecurity.password.algoritham = 'SHA-256'

grails.plugin.springsecurity.controllerAnnotations.staticRules = [
    [pattern: '/',               access: ['permitAll']],
    [pattern: '/error',          access: ['permitAll']],
    [pattern: '/index',          access: ['permitAll']],
    [pattern: '/index.gsp',      access: ['permitAll']],
    [pattern: '/shutdown',       access: ['permitAll']],
    [pattern: '/assets/**',      access: ['permitAll']],
    [pattern: '/**/js/**',       access: ['permitAll']],
    [pattern: '/**/css/**',      access: ['permitAll']],
    [pattern: '/**/images/**',   access: ['permitAll']],
    [pattern: '/**/favicon.ico', access: ['permitAll']]
]

grails.plugin.springsecurity.filterChain.chainMap = [
    [pattern: '/assets/**',      filters: 'none'],
    [pattern: '/**/js/**',       filters: 'none'],
    [pattern: '/**/css/**',      filters: 'none'],
    [pattern: '/**/images/**',   filters: 'none'],
    [pattern: '/**/favicon.ico', filters: 'none'],
    [pattern: '/**',             filters: 'JOINED_FILTERS']
]
接下来,我创建了一个application.groovy文件,并将其放置在另一个位置(不在我的项目中) 我的application.groovy文件现在如下所示:

---
grails:
    plugin:
        springsecurity:
            ldap:
                context:
                    managerDn: 'uid=admin,ou=system'
                    managerPassword: 'secret'
                    server: 'ldap://localhost:10389'
                authorities:
                    groupSearchBase: 'ou=Groups,dc=c3cen,dc=com'
                    retreiveGroupRoles: true
                    retreiveDatabaseRoles: false
                    groupSearchFilter: 'member={0}'
                search:
                    base: 'ou=Users,dc=c3cen,dc=com'
            password:
                algoritham: 'SHA-256'
            interceptUrlMap: [
                {pattern: '/',               access: ['permitAll']},
                {pattern: '/error',          access: ['permitAll']},
                {pattern: '/index',          access: ['permitAll']},
                {pattern: '/index.gsp',      access: ['permitAll']},
                {pattern: '/shutdown',       access: ['permitAll']},
                {pattern: '/assets/**',      access: ['permitAll']},
                {pattern: '/**/js/**',       access: ['permitAll']},
                {pattern: '/**/css/**',      access: ['permitAll']},
                {pattern: '/**/images/**',   access: ['permitAll']},
                {pattern: '/**/favicon.ico', access: ['permitAll']},
                {pattern: '/login/**',       access: ['permitAll']},
                {pattern: '/logout/**',      access: ['permitAll']}
            ]
---
    @Override
    void setEnvironment(Environment environment) {
        try {
            String configPath = System.getenv("local.config.location")
            def ymlConfig = new File(configPath)
            Resource resourceConfig = new FileSystemResource(ymlConfig)
            YamlPropertiesFactoryBean ypfb = new YamlPropertiesFactoryBean()
            ypfb.setResources(resourceConfig)
            ypfb.afterPropertiesSet()
            Properties properties = ypfb.getObject()
            environment.propertySources.addFirst(new PropertiesPropertySource("local.config.location", properties))
        } catch (Exception e) {
            log.error("unable to load the external configuration file", e)
        }
    }
@Override
void setEnvironment(Environment environment) {
    try {
        String configPath = System.getenv("local.config.location")
        def configFile = new File(configPath)
        def config = new ConfigSlurper().parse(configFile.toURI().toURL())
        environment.propertySources.addFirst(new MapPropertySource("externalGroovyConfig", config))
    } catch (Exception e) {
        log.error("unable to load the external configuration file", e)
    }
}
grails.plugin.springsecurity.ldap.context.managerDn = 'uid=admin,ou=system'
grails.plugin.springsecurity.ldap.context.managerPassword = 'secret'
grails.plugin.springsecurity.ldap.context.server = 'ldap://localhost:10389/'
grails.plugin.springsecurity.ldap.authorities.groupSearchBase = 'ou=Groups,dc=c3cen,dc=com'
grails.plugin.springsecurity.ldap.authorities.retreiveGroupRoles = true
grails.plugin.springsecurity.ldap.authorities.retreiveDatabaseRoles = false
grails.plugin.springsecurity.ldap.authorities.groupSearchFilter = 'member={0}'
grails.plugin.springsecurity.ldap.search.base = 'ou=Users,dc=c3cen,dc=com'

grails.plugin.springsecurity.password.algoritham = 'SHA-256'

grails.plugin.springsecurity.controllerAnnotations.staticRules = [
    [pattern: '/',               access: ['permitAll']],
    [pattern: '/error',          access: ['permitAll']],
    [pattern: '/index',          access: ['permitAll']],
    [pattern: '/index.gsp',      access: ['permitAll']],
    [pattern: '/shutdown',       access: ['permitAll']],
    [pattern: '/assets/**',      access: ['permitAll']],
    [pattern: '/**/js/**',       access: ['permitAll']],
    [pattern: '/**/css/**',      access: ['permitAll']],
    [pattern: '/**/images/**',   access: ['permitAll']],
    [pattern: '/**/favicon.ico', access: ['permitAll']]
]

grails.plugin.springsecurity.filterChain.chainMap = [
    [pattern: '/assets/**',      filters: 'none'],
    [pattern: '/**/js/**',       filters: 'none'],
    [pattern: '/**/css/**',      filters: 'none'],
    [pattern: '/**/images/**',   filters: 'none'],
    [pattern: '/**/favicon.ico', filters: 'none'],
    [pattern: '/**',             filters: 'JOINED_FILTERS']
]

我在这里注意到的奇怪之处是,interceptUrlMap是唯一一个未能从外部YML文件加载的调用。因为这是当时文档中唯一提供的用于静态路由的方法,所以我选择了不同的路由。(使用外部groovy配置,而不是yml配置)

下面是我为使用LDAP插件进行外部配置所做的工作列表。首先,我确保我的应用程序启动运行类(application.groovy)实现了环境感知。我将SetEnvironment方法改写为:

---
grails:
    plugin:
        springsecurity:
            ldap:
                context:
                    managerDn: 'uid=admin,ou=system'
                    managerPassword: 'secret'
                    server: 'ldap://localhost:10389'
                authorities:
                    groupSearchBase: 'ou=Groups,dc=c3cen,dc=com'
                    retreiveGroupRoles: true
                    retreiveDatabaseRoles: false
                    groupSearchFilter: 'member={0}'
                search:
                    base: 'ou=Users,dc=c3cen,dc=com'
            password:
                algoritham: 'SHA-256'
            interceptUrlMap: [
                {pattern: '/',               access: ['permitAll']},
                {pattern: '/error',          access: ['permitAll']},
                {pattern: '/index',          access: ['permitAll']},
                {pattern: '/index.gsp',      access: ['permitAll']},
                {pattern: '/shutdown',       access: ['permitAll']},
                {pattern: '/assets/**',      access: ['permitAll']},
                {pattern: '/**/js/**',       access: ['permitAll']},
                {pattern: '/**/css/**',      access: ['permitAll']},
                {pattern: '/**/images/**',   access: ['permitAll']},
                {pattern: '/**/favicon.ico', access: ['permitAll']},
                {pattern: '/login/**',       access: ['permitAll']},
                {pattern: '/logout/**',      access: ['permitAll']}
            ]
---
    @Override
    void setEnvironment(Environment environment) {
        try {
            String configPath = System.getenv("local.config.location")
            def ymlConfig = new File(configPath)
            Resource resourceConfig = new FileSystemResource(ymlConfig)
            YamlPropertiesFactoryBean ypfb = new YamlPropertiesFactoryBean()
            ypfb.setResources(resourceConfig)
            ypfb.afterPropertiesSet()
            Properties properties = ypfb.getObject()
            environment.propertySources.addFirst(new PropertiesPropertySource("local.config.location", properties))
        } catch (Exception e) {
            log.error("unable to load the external configuration file", e)
        }
    }
@Override
void setEnvironment(Environment environment) {
    try {
        String configPath = System.getenv("local.config.location")
        def configFile = new File(configPath)
        def config = new ConfigSlurper().parse(configFile.toURI().toURL())
        environment.propertySources.addFirst(new MapPropertySource("externalGroovyConfig", config))
    } catch (Exception e) {
        log.error("unable to load the external configuration file", e)
    }
}
grails.plugin.springsecurity.ldap.context.managerDn = 'uid=admin,ou=system'
grails.plugin.springsecurity.ldap.context.managerPassword = 'secret'
grails.plugin.springsecurity.ldap.context.server = 'ldap://localhost:10389/'
grails.plugin.springsecurity.ldap.authorities.groupSearchBase = 'ou=Groups,dc=c3cen,dc=com'
grails.plugin.springsecurity.ldap.authorities.retreiveGroupRoles = true
grails.plugin.springsecurity.ldap.authorities.retreiveDatabaseRoles = false
grails.plugin.springsecurity.ldap.authorities.groupSearchFilter = 'member={0}'
grails.plugin.springsecurity.ldap.search.base = 'ou=Users,dc=c3cen,dc=com'

grails.plugin.springsecurity.password.algoritham = 'SHA-256'

grails.plugin.springsecurity.controllerAnnotations.staticRules = [
    [pattern: '/',               access: ['permitAll']],
    [pattern: '/error',          access: ['permitAll']],
    [pattern: '/index',          access: ['permitAll']],
    [pattern: '/index.gsp',      access: ['permitAll']],
    [pattern: '/shutdown',       access: ['permitAll']],
    [pattern: '/assets/**',      access: ['permitAll']],
    [pattern: '/**/js/**',       access: ['permitAll']],
    [pattern: '/**/css/**',      access: ['permitAll']],
    [pattern: '/**/images/**',   access: ['permitAll']],
    [pattern: '/**/favicon.ico', access: ['permitAll']]
]

grails.plugin.springsecurity.filterChain.chainMap = [
    [pattern: '/assets/**',      filters: 'none'],
    [pattern: '/**/js/**',       filters: 'none'],
    [pattern: '/**/css/**',      filters: 'none'],
    [pattern: '/**/images/**',   filters: 'none'],
    [pattern: '/**/favicon.ico', filters: 'none'],
    [pattern: '/**',             filters: 'JOINED_FILTERS']
]
接下来,我创建了一个application.groovy文件,并将其放置在另一个位置(不在我的项目中) 我的application.groovy文件现在如下所示:

---
grails:
    plugin:
        springsecurity:
            ldap:
                context:
                    managerDn: 'uid=admin,ou=system'
                    managerPassword: 'secret'
                    server: 'ldap://localhost:10389'
                authorities:
                    groupSearchBase: 'ou=Groups,dc=c3cen,dc=com'
                    retreiveGroupRoles: true
                    retreiveDatabaseRoles: false
                    groupSearchFilter: 'member={0}'
                search:
                    base: 'ou=Users,dc=c3cen,dc=com'
            password:
                algoritham: 'SHA-256'
            interceptUrlMap: [
                {pattern: '/',               access: ['permitAll']},
                {pattern: '/error',          access: ['permitAll']},
                {pattern: '/index',          access: ['permitAll']},
                {pattern: '/index.gsp',      access: ['permitAll']},
                {pattern: '/shutdown',       access: ['permitAll']},
                {pattern: '/assets/**',      access: ['permitAll']},
                {pattern: '/**/js/**',       access: ['permitAll']},
                {pattern: '/**/css/**',      access: ['permitAll']},
                {pattern: '/**/images/**',   access: ['permitAll']},
                {pattern: '/**/favicon.ico', access: ['permitAll']},
                {pattern: '/login/**',       access: ['permitAll']},
                {pattern: '/logout/**',      access: ['permitAll']}
            ]
---
    @Override
    void setEnvironment(Environment environment) {
        try {
            String configPath = System.getenv("local.config.location")
            def ymlConfig = new File(configPath)
            Resource resourceConfig = new FileSystemResource(ymlConfig)
            YamlPropertiesFactoryBean ypfb = new YamlPropertiesFactoryBean()
            ypfb.setResources(resourceConfig)
            ypfb.afterPropertiesSet()
            Properties properties = ypfb.getObject()
            environment.propertySources.addFirst(new PropertiesPropertySource("local.config.location", properties))
        } catch (Exception e) {
            log.error("unable to load the external configuration file", e)
        }
    }
@Override
void setEnvironment(Environment environment) {
    try {
        String configPath = System.getenv("local.config.location")
        def configFile = new File(configPath)
        def config = new ConfigSlurper().parse(configFile.toURI().toURL())
        environment.propertySources.addFirst(new MapPropertySource("externalGroovyConfig", config))
    } catch (Exception e) {
        log.error("unable to load the external configuration file", e)
    }
}
grails.plugin.springsecurity.ldap.context.managerDn = 'uid=admin,ou=system'
grails.plugin.springsecurity.ldap.context.managerPassword = 'secret'
grails.plugin.springsecurity.ldap.context.server = 'ldap://localhost:10389/'
grails.plugin.springsecurity.ldap.authorities.groupSearchBase = 'ou=Groups,dc=c3cen,dc=com'
grails.plugin.springsecurity.ldap.authorities.retreiveGroupRoles = true
grails.plugin.springsecurity.ldap.authorities.retreiveDatabaseRoles = false
grails.plugin.springsecurity.ldap.authorities.groupSearchFilter = 'member={0}'
grails.plugin.springsecurity.ldap.search.base = 'ou=Users,dc=c3cen,dc=com'

grails.plugin.springsecurity.password.algoritham = 'SHA-256'

grails.plugin.springsecurity.controllerAnnotations.staticRules = [
    [pattern: '/',               access: ['permitAll']],
    [pattern: '/error',          access: ['permitAll']],
    [pattern: '/index',          access: ['permitAll']],
    [pattern: '/index.gsp',      access: ['permitAll']],
    [pattern: '/shutdown',       access: ['permitAll']],
    [pattern: '/assets/**',      access: ['permitAll']],
    [pattern: '/**/js/**',       access: ['permitAll']],
    [pattern: '/**/css/**',      access: ['permitAll']],
    [pattern: '/**/images/**',   access: ['permitAll']],
    [pattern: '/**/favicon.ico', access: ['permitAll']]
]

grails.plugin.springsecurity.filterChain.chainMap = [
    [pattern: '/assets/**',      filters: 'none'],
    [pattern: '/**/js/**',       filters: 'none'],
    [pattern: '/**/css/**',      filters: 'none'],
    [pattern: '/**/images/**',   filters: 'none'],
    [pattern: '/**/favicon.ico', filters: 'none'],
    [pattern: '/**',             filters: 'JOINED_FILTERS']
]