integrating spring security and saml - join 2014

19
Ordina JOIN 2014 Ken Coenen @CoenenKen Senior Java Developer Architecture & Best Practices Competence Lead at Ordina Integrating Spring Security and SAML

Upload: jworks-powered-by-ordina

Post on 14-Apr-2017

538 views

Category:

Education


5 download

TRANSCRIPT

Page 1: Integrating spring security and SAML - JOIN 2014

Ordina JOIN 2014

Ken Coenen@CoenenKen

Senior Java DeveloperArchitecture & Best Practices Competence Lead at Ordina

Integrating Spring Security and SAML

Page 2: Integrating spring security and SAML - JOIN 2014

SAML

Page 3: Integrating spring security and SAML - JOIN 2014

What is SAML?

▪ Security Assertion Markup Language▪ XML protocol▪ Approved standard▪ SAML 2.0 dates from March 2005▪ Used for eg. Single Sign-On (SSO)

Page 4: Integrating spring security and SAML - JOIN 2014

SAML overview

▪ Identity Provider (IDP)Authenticating party

▪ Service Provider (SP)Relies on the IDP and provides a service

▪ Circle of Trust (COT)Group of trusted SPs

Page 5: Integrating spring security and SAML - JOIN 2014

SAML sequence

1. User requests access to a service

2. Redirect to IDP logon page3. POST to IDP4. Redirect to application5. User can access any

application in the Circle of Trust

Page 6: Integrating spring security and SAML - JOIN 2014

Spring Security

Page 7: Integrating spring security and SAML - JOIN 2014

What is Spring Security?

▪ Part of the Spring frameworkhttp://projects.spring.io/spring-security/

▪ Provides dozens of customizable security features▪ Authentication and Authorization

→ For now we’ll focus on authentication

▪ Support for a wide range of authentication models▪ Possible to write your own

→ That’s what we’ll do!

Page 8: Integrating spring security and SAML - JOIN 2014

Authentication Concepts

▪ Filter Chain▪ Security rules for your application

▪ Entry Point▪ How an unauthenticated user tries to access secured resources▪ eg. Form login, OpenID, basic authentication, ...

▪ Manager▪ Manages authentication requests▪ Uses AuthenticationProvider and User Details Service

Page 9: Integrating spring security and SAML - JOIN 2014

Putting the pieces together

Page 10: Integrating spring security and SAML - JOIN 2014

Include Maven dependencies

Check latest dependencies on http://projects.spring.io/spring-security/

Page 11: Integrating spring security and SAML - JOIN 2014

Include Maven dependencies (2)

OpenAM library to interpret SAML assertion and perform redirects

Page 12: Integrating spring security and SAML - JOIN 2014

Map Spring Security filter in web.xml

▪ Let your J2EE application know we’re using Spring Security

Page 13: Integrating spring security and SAML - JOIN 2014

Authentication Filter Chain

Page 14: Integrating spring security and SAML - JOIN 2014

Filter Chain

Triggered if not authenticated

1. Redirect to IDP

2. Process SAMLassertion

Page 15: Integrating spring security and SAML - JOIN 2014

▪ Extends GenericFilterBean

Request initiator

Redirect to the IDP

Page 16: Integrating spring security and SAML - JOIN 2014

Process the SAML response

▪ Extends AbstractAuthenticationProcessingFilter

Wrap our SAML assertion in a PreAuthenticated-AuthenticationToken in the request parameters

Page 17: Integrating spring security and SAML - JOIN 2014

Processes Authentication object

Authentication Manager

Triggers the User Details Service to authenticate the user

Interpret SAML attributes

Page 18: Integrating spring security and SAML - JOIN 2014

▪ Extends AuthenticationUserDetailsService<PreAuthenticatedAuthenticationToken>

▪ Maps SAML assertions to Spring privileges

Custom User Details Service

Page 19: Integrating spring security and SAML - JOIN 2014

Q&A