Giter Club home page Giter Club logo

identity-agent-saml-sso's Introduction

identity-agent-saml-sso

Identity-agent-saml-sso provides the capability to communicate with your IDP(i.e. WSO2 Identity Server) in a really easy manner. You do not have to write any new java code to use this agent in your web application. All the mandatory functionality is included already. Further, this agent resides in this repository as module 'agent' you can build the agent as a single jar.

How to use Agent for a web application.

Process of including SAML SSO Agent to your web application can be described in three main steps.

First Step: You have to provide the properties that you wish to use. For that you can add the .properties file to your web application under the directory: src/main/resources. This properties file should include the relevant properties that are required to perform communication with wso2 identity server via SAML flow.

NOTE: You can define properties as context-params in the web.xml too. However the effective set of properties have 
the following priority. 
Highest -> properties defined in .properties file
Mid     -> properties defined as context-params
lowest  -> default values assumed for properties

Thus, higer priority will override the redundant occurrences.
The list of properties and their default values assumed by the agent are as follows:

Mandatory properties that must be defined either in .properties file or as context-params are as follows.

Property Description sample value
SAML2.SPEntityId Used to uniquely identify service provider.Should be same as in idp. demo-sso-agent
SAML2.AssertionConsumerURL Assertion consumer url of sp. Should be same as in IDP http://localhost:8080/demo-sso-agent/samlcallback

Second Step: Next step is adding the agent to your web application. If you web applicaiton is a Maven web project then add the below dependency. Or else you can add the jar you get after building the module agent.

 <dependency>
    <groupId>org.wso2.carbon.identity.agent.sso.java</groupId>
    <artifactId>identity-agent-saml-sso-agent-component-agent</artifactId>
    <version>1.0.0</version>
 </dependency>

Third Step: Then you have to add the SAMLSSO Filter to your web application's web.xml file as shown below.

 <filter>
       <filter-name>SAML2SSOAgentFilter</filter-name>
       <filter-class>org.wso2.carbon.identity.sso.agent.SAML2SSOAgentFilter</filter-class>
 </filter>
 <filter-mapping>
         <filter-name>SAML2SSOAgentFilter</filter-name>
         <url-pattern>/samlsso</url-pattern>
     </filter-mapping>
     <filter-mapping>
         <filter-name>SAML2SSOAgentFilter</filter-name>
         <url-pattern>/samlcallback</url-pattern>
     </filter-mapping>
     <filter-mapping>
         <filter-name>SAML2SSOAgentFilter</filter-name>
         <url-pattern>/samllogout</url-pattern>
     </filter-mapping>

In the above code sample, we can see that three url patterns are mapped to this filter. The pattern /samlsso is used to initiate SAML flow with the agent. Then the /samlcallback is used to map the callback from the IDP( WSO2 Identity Server). /samllogout is used to map the SAML logout request.

Sample web application with SAML Agent

This repository contains a module called 'sample' which contains a simple sample web application the usage of SAML SSO Agent. You can deploy the .war file in sample/target directory into tomcat server.

identity-agent-saml-sso's People

Contributors

maheshika avatar sagara-gunathunga avatar

Watchers

 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.