Oracle OAM implements Angular JS front-end application SSO Single Sign-On tutorial, oamsso

Source: Internet
Author: User

Oracle OAM implements Angular JS front-end application SSO Single Sign-On tutorial, oamsso

Background:

With the development of the front-end framework, many front-end applications use Angular JS to implement front-end portals. How to Use OAM to implement a single point of failure for front-end portals is a problem. As we all know, it is much simpler to implement SSO for programs developed by the ADF or Oracle products. The following describes how to implement SSO for Angular JS frontend applications using OAM and how to implement SSO.

Implementation

1. Create a New ADF application and enable security. In the application, build a servlet and use ohs as the proxy. The request address is OHS: 80/security/authguard;

2. Use OAM to configure/Angular and/security to protect resources;

3./security/authguard is used to obtain the user through request. getHeader ("OAM_REMOTE_USER"), obtain a token available for the Angular application interface, and return a json object:

4. All routes applied on the Angular front-end must go through a global route guard. This route guard will request the/security/authguard address and try to obtain the json object, if token and username are obtained, the interface is called normally. Otherwise, the logon page is displayed.

Steps

1. Create an ADF application, create the AuthguardServlet class, and obtain the token and username. The key code is as follows:

2. Enable Security BASIC Authentication for the ADF application and modify the web. xml configuration file, as shown in figure

3. Servlet returns a JSON object, for example:

{

"Code": 200,

"Data ":{

"UserCode": "zhangsan ",

"Roles": ["role 1", "role 2", "role 3"],

"UserDisplayName": "James"

},

"Token": "hUIDiwIOVHsqQvisMgodKJuaQNWLvNFfJq ",

"Username": "zhangsan"

}

4. Configure resource protection for front-end applications (/Angular) and servlets (/security/authguard) through OAM, for example;

5. All routes applied on the Angular front-end must go through a global route guard. This route guard will request the/security/authguard address and try to obtain the json object, if token and username are obtained, the interface is called normally. Otherwise, the logon page is displayed. The implementation code is as follows:

In this way, the Angular JS frontend application SSO is implemented.

Advantage: The OAM protection page is still used, and no additional technology is required to consider the single-point login implementation from static pages to Oracle products.

Related Article

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.