Developing OpenAM Java Client

Source: Internet
Author: User

Development OpenAM Java Client after the Agent installation is complete, you can log in with your own Agentsample app. The main point here is how to get ssotoken after SSO, as well as the relevant Session information. Complete code on Github.

The installation of the Agent is described in the previous article, where you need to configure a policies and then add it to the client Project Web. xml

<filter>    <filter-name>Agent</filter-name>    <display-name>Agent</display-name>    <description>SJS Access Manager Tomcat Policy Agent Filter</description>    <filter-class>com.sun.identity.agents.filter.AmAgentFilter</filter-class></filter><filter-mapping>    <filter-name>Agent</filter-name>    <url-pattern>/*</url-pattern>    <dispatcher>REQUEST</dispatcher>    <dispatcher>INCLUDE</dispatcher>    <dispatcher>FORWARD</dispatcher>    <dispatcher>ERROR</dispatcher></filter-mapping>

Get token-related content in your project

SSOTokenManager manager = SSOTokenManager.getInstance();SSOToken token = manager.createSSOToken(request);if (manager.isValidToken(token)) {    java.security.Principal principal = token.getPrincipal();    out.println("SSOToken Principal name: " + principal.getName());            out.println("<br />");}
Deploy two identical apps to Tomcat, named Client1,client2, respectively. Access any app and another app is automatically logged in.

Developing OpenAM Java Client

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.