Upgrade to Pro — share decks privately, control downloads, hide ads and more …

SSO for Microservices and Distributed Java Apps

Niko Köbler
November 08, 2016

SSO for Microservices and Distributed Java Apps

Niko Köbler

November 08, 2016
Tweet

More Decks by Niko Köbler

Other Decks in Programming

Transcript

  1. OAUTH2 Authorization, NOT Authentication! The OAuth 2.0 authorization framework enables

    a 3rd-party application to obtain limited access to an HTTP service. IETF
  2. OIDC OpenID Connect - NOT OpenID Authentication layer on top

    of OAuth 2.0 verify the identity of an end-user obtain basic profile information about the end-user RESTful HTTP API, using JSON as data format allows clients of all types (web-based, mobile, JavaScript) OpenID Foundation
  3. BUT, WANTS TO THEIR ENTERPRISE TO GOOGLE/TWITTER/FACEBOOK? WHO STORE USER

    DATA Plus, additional: LDAP / AD other Directories other Database Tables need to be integrated!
  4. DO IT ON !? YOUR OWN for each and every

    application password recovery registration remember me user/email verification ...? And your users should login (and authenticate) themselves at each of your applications? Over and over again? With different passwords?
  5. SAML <saml:Assertion xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ID="b07b804c-7c29-ea16-7300-4f3d6f7928ac" Version="2.0" IssueInstant="2004-12-05T09:22:05"> <saml:Issuer>https://idp.example.org/SAML2</saml:Issuer> <ds:Signature

    xmlns:ds="http://www.w3.org/2000/09/xmldsig#">...</ds:Signatu <saml:Subject> <saml:NameID Format="urn:oasis:names:tc:SAML:2.0:nameid-format:transient" 3f7b3dcf-1674-4ecd-92c8-1544f346baf8 </saml:NameID> <saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer" <saml:SubjectConfirmationData InResponseTo="aaf23196-1773-2113-474a-fe114412ab72" Recipient="https://sp.example.com/SAML2/SSO/POST" NotOnOrAfter="2004-12-05T09:27:05"/> </saml:SubjectConfirmation> </saml:Subject> ... </saml:Assertion> OASIS Standard, 2005
  6. TOKENS Base for access on secured resources. A is and

    contains all necessary about the user and its roles. token signed information Kinds: , Refresh-, Offline- and Identity- Accesstokens Hava a TTL! Must be revocable!
  7. WHAT DOES JAVA OFFER? JAVA EE nothing useful so far

    JAAS? (proprietary) perhaps Java EE 8 (Security API, JSR-375)
  8. WHAT DOES JAVA OFFER? PAC4J http://www.pac4j.org The to protect all

    your web applications. Java security engine Available for most frameworks/tools: J2E • Spring Web MVC (Spring Boot) • Spring Security (Spring Boot) • Shiro Play 2.x • Vertx • Spark Java • Ratpack • Undertow CAS server • JAX-RS • Dropwizard • Knox • Jooby
  9. AND THE ? ECOSYSTEM SAAS? AAAS? Auth0 auth0.com AWS Cognito

    aws.amazon.com/cognito Stormpath stormpath.com But again, you have to outsource your users personal data!
  10. KEYCLOAK JBoss since ~2013 Open Source So ware hosted at

    GitHub very active Community (commits, pullrequests, mailinglists) constant and regular feature- and bugfix-releases current version: 2.3.0.Final good & comprehensive documentation
  11. #FEATURES Single-Sign-On, Single-Sign-Out, Self-Registration, Forgot Password, Verify User/Email, TOTP, various

    Verification (Work-)Flows, Customer Attributes, Custom Federation Provider, SPIs, Social Logins, Custom Themes, JWT, OAuth2, Bearer Token, Open ID Connect (OIDC), SAML, Account Management, Management Console, CORS handling, Impersonation, etc...
  12. STANDARDS SAML 2.0 OASIS 2005 OAuth 2.0 RFC 6749 2012

    OpenID Connect 1.0 OpenID Foundation 2014 JWT RFC 7519 2015
  13. ADAPTERS (I) JBoss EAP (6, 7) / Wildfly (9, 10)

    Tomcat (6, 7, 8) Jetty (8.1.x, 9.x) JBoss Fuse Apache Karaf Spring Boot Spring Security Servlet Adapter JavaScript own implementation
  14. LOGIN redirect to Keycloak, user logged in, back to application,

    handle tokens, application delivers resource
  15. DEMO Spring Boot ("full" web app) dasniko/keycloak-springboot-demo Java EE (JBoss

    Wildfly, REST-only services) dasniko/keycloak-javaee-demo React.JS SPA (JavaScript client app)