Difference between revisions of "Oauth"
m (Elizabeth Marion moved page 3forge Documentation:Security to Security over redirect) |
|||
Line 1: | Line 1: | ||
+ | <h2>1 | Introduction</h2> | ||
+ | |||
+ | OAuth is one of the multiple ways you can authenticate users to 3forge AMI. The 3forge AMI OAuth Plugin makes it easy to integrate AMI with any OAuth based identity manager. It provides a simple standard authentication mechanism and allows you to build access control into your 3forge AMI Layouts. | ||
+ | |||
+ | Go to <strong>Section 2 OAuth Quickstart</strong> to quickly get started with using the OAuthPlugin. | ||
+ | <h2>2 | OAuth Quickstart</h2><h3>2.1 | Quickstart Instructions</h3> | ||
+ | |||
+ | Prerequisites: | ||
+ | <ol><li>Find out your identity provider and ensure it allows for OAuth 2.0 Authentication. You will need to know the identity provider url. | ||
+ | |||
+ | <li>Register a new Web App with your identity provider. | ||
+ | <ol type="a"><li>Provide a Sign In Redirect Url, we recommend https://<your-server>:33332/oauthRedirectUrl | ||
+ | <ol type="i"><li>This will be used in the oauth.redirect.url property | ||
+ | </li></ol><li>Provide a Sign Out Redirect Url (Optional but recommended) | ||
+ | </li></ol></li></ol> | ||
+ | |||
+ | |||
+ | How to setup the OAuth Plugin | ||
+ | <ol><li>Navigate to your 3forge AMI config directory, it's typically located in <em> ami\amione\config </em><li>Create a file called local.properties if one is not already present | ||
+ | |||
+ | <li>Add the properties from Section 2.2 Minimal Configuration to the file <em>local.properties</em><li>Update the values of the properties to match your identity provider. | ||
+ | |||
+ | <li>Restart 3forge AMI | ||
+ | |||
+ | </li></ol><h3>2.2 | Minimal Configuration </h3> | ||
+ | |||
+ | Note: Please refer to Section 3 <em>OAuth Full Properties List </em>for a detailed understanding of each property | ||
+ | |||
+ | |||
+ | sso.plugin.class=com.f1.ami.web.AmiWebOAuthPluginImpl | ||
+ | |||
+ | |||
+ | <strong># Provide the url to your OAuth 2.0 identity provider</strong> | ||
+ | |||
+ | oauth.server.domain=https://oauthprovider.com | ||
+ | |||
+ | |||
+ | <strong># Provide the redirect url that you configured for the app with your identity provider</strong> | ||
+ | |||
+ | oauth.redirect.uri=http://localhost:33332/oauthRedirectUrl | ||
+ | |||
+ | |||
+ | <strong># Provide the endpoints for authorization, token and refresh token</strong> | ||
+ | |||
+ | oauth.authorization.endpoint=/authorizeEndpoint | ||
+ | |||
+ | oauth.token.endpoint=/tokenEndpoint | ||
+ | |||
+ | oauth.refresh.token.endpoint=/refreshTokenEndpoint | ||
+ | |||
+ | |||
+ | <strong># Provide the client id and secret that will be used for the OAuth authentication</strong> | ||
+ | |||
+ | oauth.client.id=clientid | ||
+ | |||
+ | oauth.client.secret=secret | ||
+ | |||
+ | |||
+ | <strong># Replace this with the default scope that is used for Web Based Applications in your firm</strong> | ||
+ | |||
+ | oauth.scope=openid profile email offline_access | ||
+ | |||
+ | |||
+ | <strong># Replace this with unique identifier that identifies the user</strong> | ||
+ | |||
+ | oauth.username.field=email | ||
+ | |||
+ | |||
+ | <strong># Recommended to replace this with an attribute that identifies the group a user belongs to</strong> | ||
+ | |||
+ | oauth.ami.isdev.field=email | ||
+ | |||
+ | oauth.ami.isdev.values=<comma_delimited_list_of_emails> | ||
+ | |||
+ | |||
+ | <strong># Logout Page AMI will display when logged out</strong> | ||
+ | |||
+ | web.logged.out.url=/loggedout.htm | ||
+ | |||
+ | |||
+ | <strong># This is enabled for development, disable this after OAuth has been setup</strong> | ||
+ | |||
+ | oauth.debug=true | ||
+ | |||
+ | |||
+ | <h2>3 | OAuth Full Properties List</h2> | ||
+ | |||
+ | |||
+ | {| class="wikitable" style="margin:auto" | ||
+ | |- | ||
+ | ! Description !! Property and Default Value | ||
+ | |- | ||
+ | | <span style="color:#FF0000">REQUIRED</span> <br /> Specify class to use Oauth SSO || sso.plugin.class=com.f1.ami.web.AmiWebOAuthPluginImpl | ||
+ | |- | ||
+ | | <span style="color:#FF0000">REQUIRED</span> <br /> The domain of the auth server account || oauth.server.domain=https://oauthprovider.com | ||
+ | |- | ||
+ | | <span style="color:#FF0000">REQUIRED</span> <br /> Set AMI logged out page || web.logged.out.url=/loggedout.htm | ||
+ | |- | ||
+ | | <span style="color:#FF0000">REQUIRED</span> <br /> 3forge AMI Url for Oauth server to redirect after login || oauth.redirect.uri=http://localhost:33332/oauthRedirectUrl/ | ||
+ | |- | ||
+ | | <span style="color:#FF0000">REQUIRED</span> <br /> Client ID || oauth.client.id=clientid | ||
+ | |- | ||
+ | | <span style="color:#FF0000">REQUIRED</span> <br /> Client secret || oauth.client.secret=secret | ||
+ | |- | ||
+ | | <span style="color:#FF0000">REQUIRED</span> <br /> Authorization endpoint || oauth.authorization.endpoint=/authorizeEndpoint | ||
+ | |- | ||
+ | | <span style="color:#FF0000">REQUIRED</span> <br /> Token endpoint || oauth.token.endpoint=/tokenEndpoint | ||
+ | |- | ||
+ | | <span style="color:#FF0000">REQUIRED</span> <br /> Oauth scope || oauth.scope=openid profile email offline_access | ||
+ | |- | ||
+ | | <span style="color:#FF0000">REQUIRED</span> <br /> User Email || oauth.username.field=email | ||
+ | |- | ||
+ | | <span style="color:#3c78d8">OPTIONAL</span> <br /> The endpoint to get the refresh token || oauth.refresh.token.endpoint=/refreshTokenEndpoint | ||
+ | |- | ||
+ | | <span style="color:#3c78d8">OPTIONAL</span> <br /> Dev User Email || oauth.ami.isdev.field=email | ||
+ | |- | ||
+ | | <span style="color:#3c78d8">OPTIONAL</span> <br /> List of dev user emails || oauth.ami.isdev.values=<comma_delimited_list_of_emails> | ||
+ | |- | ||
+ | | <span style="color:#3c78d8">OPTIONAL</span> <br /> Key that contains the time the access token expires in || oauth.access.token.expires.in=expires_in | ||
+ | |- | ||
+ | | <span style="color:#3c78d8">OPTIONAL</span> <br /> Code challenge method || oauth.code.challenge.method=S256 | ||
+ | |- | ||
+ | | <span style="color:#3c78d8">OPTIONAL</span> <br /> Java hashing algorithm || oauth.digest.algo=SHA-256 | ||
+ | |- | ||
+ | | <span style="color:#3c78d8">OPTIONAL</span> <br /> Seconds to check refresh token expiration || oauth.session.check.period.seconds=60 | ||
+ | |- | ||
+ | | <span style="color:#3c78d8">OPTIONAL</span> <br /> The 3forge AMI endpoint that triggers the build auth request. || ami.web.index.html.file=index2.htm | ||
+ | |- | ||
+ | | <span style="color:#3c78d8">OPTIONAL</span> <br /> Enables Debugging Mode || oauth.debug=true | ||
+ | |||
+ | |} | ||
+ | |||
+ | |||
+ | |||
+ | <h2>4 | Creating your own AMI OAuth Plugin</h2> | ||
+ | |||
+ | The AMI OAuth plugin handles authorization code and access token requests that are needed for Authenticating to AMI. By extending the 3forge AMI OAuth plugin, you can create your own Ami OAuth Plugin if you have custom requirements for access control or entitlements. | ||
+ | |||
+ | |||
+ | There are three main components to the 3forge AMI OAuth Plugin: buildAuthRequest, processResponse, and createAmiUserSSOSession. | ||
+ | <h3>4.1 | Main Components of the 3forge AMI OAuth Plugin</h3> | ||
+ | |||
+ | The <strong>buildAuthRequest </strong>method is responsible for creating the url for the Authorization Code request. | ||
+ | |||
+ | |||
+ | The <strong>processResponse </strong>method is responsible for processing the response from the Authorization Code request, then building an Access Token request. Once it obtains an access token, it needs to return an AmiAuthUser. | ||
+ | |||
+ | |||
+ | The <strong>createAmiUserSSOSession </strong>is responsible for creating the AmiAuthUser and OAuthSSO Session. The AmiAuthUser can be used to set user session variables or restrict access to layouts. The OAuth Session is accessible in AMIScript by session.getSsoSession(). | ||
+ | |||
+ | |||
+ | <h3>4.3 | Example Configuration</h3> | ||
+ | |||
+ | sso.plugin.class=com.company.3forge.AmiWebOAuthPluginSample | ||
+ | |||
+ | |||
+ | <nowiki># Include the same properties you need for the Quick Start Guide</nowiki> | ||
+ | |||
+ | |||
+ | <nowiki># ...</nowiki> | ||
+ | |||
+ | |||
+ | <nowiki># Enabling debug for development to help with diagnosing</nowiki> | ||
+ | |||
+ | |||
+ | oauth.debug=true |
Revision as of 19:33, 22 March 2023
1 | Introduction
OAuth is one of the multiple ways you can authenticate users to 3forge AMI. The 3forge AMI OAuth Plugin makes it easy to integrate AMI with any OAuth based identity manager. It provides a simple standard authentication mechanism and allows you to build access control into your 3forge AMI Layouts.
Go to Section 2 OAuth Quickstart to quickly get started with using the OAuthPlugin.
2 | OAuth Quickstart
2.1 | Quickstart Instructions
Prerequisites:
- Find out your identity provider and ensure it allows for OAuth 2.0 Authentication. You will need to know the identity provider url.
- Register a new Web App with your identity provider.
- Provide a Sign In Redirect Url, we recommend https://<your-server>:33332/oauthRedirectUrl
- This will be used in the oauth.redirect.url property
- Provide a Sign Out Redirect Url (Optional but recommended)
- Provide a Sign In Redirect Url, we recommend https://<your-server>:33332/oauthRedirectUrl
How to setup the OAuth Plugin
- Navigate to your 3forge AMI config directory, it's typically located in ami\amione\config
- Create a file called local.properties if one is not already present
- Add the properties from Section 2.2 Minimal Configuration to the file local.properties
- Update the values of the properties to match your identity provider.
- Restart 3forge AMI
2.2 | Minimal Configuration
Note: Please refer to Section 3 OAuth Full Properties List for a detailed understanding of each property
sso.plugin.class=com.f1.ami.web.AmiWebOAuthPluginImpl
# Provide the url to your OAuth 2.0 identity provider
oauth.server.domain=https://oauthprovider.com
# Provide the redirect url that you configured for the app with your identity provider
oauth.redirect.uri=http://localhost:33332/oauthRedirectUrl
# Provide the endpoints for authorization, token and refresh token
oauth.authorization.endpoint=/authorizeEndpoint
oauth.token.endpoint=/tokenEndpoint
oauth.refresh.token.endpoint=/refreshTokenEndpoint
# Provide the client id and secret that will be used for the OAuth authentication
oauth.client.id=clientid
oauth.client.secret=secret
# Replace this with the default scope that is used for Web Based Applications in your firm
oauth.scope=openid profile email offline_access
# Replace this with unique identifier that identifies the user
oauth.username.field=email
# Recommended to replace this with an attribute that identifies the group a user belongs to
oauth.ami.isdev.field=email
oauth.ami.isdev.values=<comma_delimited_list_of_emails>
# Logout Page AMI will display when logged out
web.logged.out.url=/loggedout.htm
# This is enabled for development, disable this after OAuth has been setup
oauth.debug=true
3 | OAuth Full Properties List
Description | Property and Default Value |
---|---|
REQUIRED Specify class to use Oauth SSO |
sso.plugin.class=com.f1.ami.web.AmiWebOAuthPluginImpl |
REQUIRED The domain of the auth server account |
oauth.server.domain=https://oauthprovider.com |
REQUIRED Set AMI logged out page |
web.logged.out.url=/loggedout.htm |
REQUIRED 3forge AMI Url for Oauth server to redirect after login |
oauth.redirect.uri=http://localhost:33332/oauthRedirectUrl/ |
REQUIRED Client ID |
oauth.client.id=clientid |
REQUIRED Client secret |
oauth.client.secret=secret |
REQUIRED Authorization endpoint |
oauth.authorization.endpoint=/authorizeEndpoint |
REQUIRED Token endpoint |
oauth.token.endpoint=/tokenEndpoint |
REQUIRED Oauth scope |
oauth.scope=openid profile email offline_access |
REQUIRED User Email |
oauth.username.field=email |
OPTIONAL The endpoint to get the refresh token |
oauth.refresh.token.endpoint=/refreshTokenEndpoint |
OPTIONAL Dev User Email |
oauth.ami.isdev.field=email |
OPTIONAL List of dev user emails |
oauth.ami.isdev.values=<comma_delimited_list_of_emails> |
OPTIONAL Key that contains the time the access token expires in |
oauth.access.token.expires.in=expires_in |
OPTIONAL Code challenge method |
oauth.code.challenge.method=S256 |
OPTIONAL Java hashing algorithm |
oauth.digest.algo=SHA-256 |
OPTIONAL Seconds to check refresh token expiration |
oauth.session.check.period.seconds=60 |
OPTIONAL The 3forge AMI endpoint that triggers the build auth request. |
ami.web.index.html.file=index2.htm |
OPTIONAL Enables Debugging Mode |
oauth.debug=true |
4 | Creating your own AMI OAuth Plugin
The AMI OAuth plugin handles authorization code and access token requests that are needed for Authenticating to AMI. By extending the 3forge AMI OAuth plugin, you can create your own Ami OAuth Plugin if you have custom requirements for access control or entitlements.
There are three main components to the 3forge AMI OAuth Plugin: buildAuthRequest, processResponse, and createAmiUserSSOSession.
4.1 | Main Components of the 3forge AMI OAuth Plugin
The buildAuthRequest method is responsible for creating the url for the Authorization Code request.
The processResponse method is responsible for processing the response from the Authorization Code request, then building an Access Token request. Once it obtains an access token, it needs to return an AmiAuthUser.
The createAmiUserSSOSession is responsible for creating the AmiAuthUser and OAuthSSO Session. The AmiAuthUser can be used to set user session variables or restrict access to layouts. The OAuth Session is accessible in AMIScript by session.getSsoSession().
4.3 | Example Configuration
sso.plugin.class=com.company.3forge.AmiWebOAuthPluginSample
# Include the same properties you need for the Quick Start Guide
# ...
# Enabling debug for development to help with diagnosing
oauth.debug=true