jeffwils / grails-spring-security-saml

Grails Spring Security SAML2.0 Plugin for Grails 3
8 stars 24 forks source link

UTF8 support for MetadataDisplayFilter #16

Closed valentingoebel closed 6 years ago

valentingoebel commented 6 years ago

This has been addressed in version 1.04 of Spring Security SAML which isn't released yet.

See here: https://github.com/spring-projects/spring-security-saml/blob/master/core/src/main/java/org/springframework/security/saml/metadata/MetadataDisplayFilter.java#L117

Right now I'm using this workaround:

MetadataDisplayFilterUTF8.groovy

@CompileStatic
class MetadataDisplayFilterUTF8 extends MetadataDisplayFilter {
    @Override
    protected void processMetadataDisplay(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
        response.setCharacterEncoding("UTF-8")
        super.processMetadataDisplay(request,response)
    }
}

resources.groovy

    metadataFilter(MetadataDisplayFilterUTF8) {
        filterProcessesUrl = '/saml/metadata'
    }

Because the filterProccessesUrl can be configured in the application.yml I would prefer it if this workaround was integrated directly in grails-spring-security-saml until the 1.04 release is available.

Maybe there is an alternative way of achieving this that doesn't involve patching MetadataDisplayFilter but I'm not aware of it.