Skip to content

Instantly share code, notes, and snippets.

@Kallin
Created June 22, 2012 17:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kallin/2974211 to your computer and use it in GitHub Desktop.
Save Kallin/2974211 to your computer and use it in GitHub Desktop.
SamlAuthenticationFilter.groovy
class SamlAuthenticationFilter extends AbstractAuthenticationProcessingFilter {
public SamlAuthenticationFilter() {
super("/somecustomauth")
}
@Override
Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) {
if (!request.getMethod().equals("POST")) {
throw new AuthenticationServiceException("Authentication method not supported: " + request.getMethod())
}
String accessToken = request.getParameter("sometoken")
return this.getAuthenticationManager().authenticate(new SamlAuthenticationToken(accessToken));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment