Generate an access token
- Last Updated: January 16, 2024
- 3 minute read
- OpenEdge
- Version 12.8
- Documentation
Description
Generates a base64-encoded JSON string containing an OAuth2 access token and adds the token to the cache for validation requests. System Administrators must supply a set of properties in claims of the access token, and then configure PAS for OpenEdge and OpenEdge Authentication Gateway to supply the required claims.
- For more information on PAS for OpenEdge security configurations, see $DLC/servers/pasoe/conf/oeablSecurity.properties.README.
- For more information on OpenEdge Authentication Gateway security configurations, see ../conf/oeablSecurity.properties.README file.
OESECTOOL does not support generating opaque tokens. For remote validation tests, use a non-opaque token. For more information about using web tokens, see Authenticate using OAuth2 and JWT.
Configure the OAuth2 server properties
Edit the oesectool-oauth2.properties file to work with the PAS for
OpenEdge or OpenEdge Authentication gateway configurations, as follows:
- Set the users IDs for the users.
sectool.user.ids=user1,user2 - Set the properties for the users.
user1.sub="yshre@progress.com" user1.preferred_username="yshre@progress.com" user1.given_name="York" user1.family_name="Shrek" user1.name="York Shrek" user1.email="yshre@progress.com" user1.locale="US" user1.id="00u2k1xc0fHUEeghc5d7" user1.zoneinfo="America/Los_Angeles" user1.scope="PSCUser" user2.sub="kludil@progress.com" user2.preferred_username="kludil@progress.com" user2.given_name="Kunel" user2.family_name="Ludilschik" user2.name="Kunel Ludilschik" user2.email="kludil@progress.com" user2.locale="US" user2.id="00u2k1xc0fHUEeghclmc" user2.zoneinfo="America/Los_Angeles" user2.scope="PSCUser" - Set the claims. The claims begin with
access.token.prefix. The claims foruser1include:#access.token. access.token.ver=1 access.token.jti="${general.access_token_jti}" access.token.iss="${general.iss}" access.token.aud="${general.aud}" access.token.sub="${${sectool.user.id}.sub}" access.token.iat=now access.token.exp=now+1h access.token.cid="${general.cid}" access.token.uid="${${sectool.user.id}.id}" access.token.scope="${${sectool.user.id}.scope}" access.token.scp=["openid","email","profile"] access.token.token_use="access"Note: Values${${sectool.user.id}.sub}and${${sectool.user.id}.id}are thesubandidproperties for a user. For example:
Time properties are:user1.sub="kyork@progress.com" user1.id="00u2k1xc0fHUEeghc5d7"
where:now[+|-{y|M|d|h|m|s}{integer}]- now—current time
- y —year
- M —month
- d —day
- m—minute
- s—second
- Sign the access token using the security key defined in one of the following ways:
- By using a client
oesectoolshared secret. - By using a private key from a PAS for OpenEdge keystore.
- The shared secret is defined by the
token.key.secretproperty. PAS for OpenEdge oeablSecurity.properties has thejwtToken.macKeyproperty, which has the same value. This value is encrypted. - Comment out
token.key.secretbecause there are a number of ways to obtain a public key to validate signature, including:- Request the public keys from the oauth2server.
- Request the configuration properties from the oauth2server—Extract the URL to get
public keys. Get
jwks_urito call oauth2server, to get public keys and the verified PEM file with a public key or certificate. - Use a PEM file with a public key or certificate.
- Optional. To the JWE tokens, provide the following
properties that match PAS for OpenEdge and the subset
available for OpenEdge Authentication Gateway
properties:
token.key.encalias - a key alias from PASOE keystore. Example: defaultkey token.key.encalg - algorithm to use. Example: RSA-OAEP-256 token.key.encmethod - encryption method. Example: A256CBC-HS512
Note: The OpenEdge Advanced Security add-on is required to use JWE tokens. - The shared secret is defined by the
- By using a client
HTTP Operation
GET
URL
|
Example
With the server started, use a browser to generate an access token.
|
Result
The encoded JWS access token is:
|
Note: The token was formatted to fit
the page.
The decoded token is:
|
Note: JWE tokens add an extra layer of security by
encrypting the token so that it cannot be read without the additional step of
decrypting the token.