Git Product home page Git Product logo

enforce-associations-post-authentication-handler's Introduction

enforce-associations-post-authentication-handler

Background

Post authentication handlers are a set of handlers which executes upon successful authentication through WSO2 Identity Server (IS) authentication framework. For example, if you do a Single Sign On(SSO) your application through an IS instance or any WSO2 product which supports SSO authentication then upon successful authentication these handlers will get executed.

An important fact you need to keep in mind is even though you successfully finished your authentication steps (basic, totp etc) you will still not be an authenticated person until you pass the post authentication flow. Existing post authenticators are AuthorizationHandler and missing mandatory claim handler which are getting executed upon successful authentication.

Enforce Associations

WSO2 IS supports to create a mapping (ie. association) between federated identities and local identities.

And when using federated authentication, instead of sending federated user's subject\attributes, WSO2 IS can send associated local user's subject attribute if there is an associated account. This is done by enabling Assert identity using mapped local subject identifier flag in the service provider configuration.

This capability is handled by PostAuthAssociationHandler, but it's treating mapping from federated subject to local subject as an optional step. ie. It's convert federated subject to local subject if there is a association for that federated subject. Otherwise its returns federated subject to the service provider.

As some service providers always expects local subjects as those cannot handle federated subjects or those expects some additional attributes\features that need local subject, in some cases its need to break the authentication flow if there is no association exists.

This extension can be used to,

  • Enforce associations (and break the authentication flow) for federated subjects
  • For service providers that has enabled "Assert identity using mapped local subject identifier" flag
  • During federated logins

Table of contents

Tested versions

  • IS 5.6.0

How to build

Build from source

Prerequisites

  1. Get a clone or download source from this repository
  2. Run the Maven command mvn clean install from base pom.

How to deploy

  1. Build the sample as mentioned in How to build section.
  2. Copy target/org.wso2.is.sample.post.authn.handler.association.enforcer-1.0.0-SNAPSHOT.jar to <IS_HOME>/repository/components/dropins/ directory.
  3. Open <IS_HOME>/repository/conf/identity/identity.xml.
  4. Add new EventListener for the new AssociationEnforcerPostAuthenticationHandler as follows,
        <EventListener type="org.wso2.carbon.identity.core.handler.AbstractIdentityHandler"
                       name="org.wso2.carbon.identity.post.authn.handler.association.enforcer.AssociationEnforcerPostAuthenticationHandler"
                       orderId="25" enable="true"/>
  1. Save and close <IS_HOME>/repository/conf/identity/identity.xml.
  2. Start the server.

How to test

Try to login with a federated user, that does not have an association. It will show an error page.

enforce-associations-post-authentication-handler's People

Contributors

darshanasbg avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.