Enabling single sign on for clients via JWT token configuration
Enabling single sign on for clients via JWT token configuration
As a system programmer, you can customize how JWT authentication is performed, the service that provides the JWT authentication token, whether it's possible to refresh JWT token and other characteristics of JWT for consumption.
- Using SAF as an authentication provider
- Enabling a JWT token refresh endpoint
- Authorization
- Additional customizable properties when using JWT tokens
Using SAF as an authentication provider
By default, the API Gateway uses z/OSMF as an authentication provider. It is possible to switch to SAF as the authentication provider instead of z/OSMF. The intended usage of SAF as an authentication provider is for systems without z/OSMF. If SAF is used and the z/OSMF is available on the system, the created tokens are not accepted by z/OSMF. Use the following procedure to switch to SAF.
- Open the
zowe.yaml
configuration file. - Find or add the following property, and set the value to
saf
:
components.gateway.apiml.security.auth.provider
- Restart Zowe.
Authentication requests now utilize SAF as the authentication provider. API ML can run without z/OSMF present on the system.
Enabling a JWT token refresh endpoint
Enable the /gateway/api/v1/auth/refresh
endpoint to exchange a valid JWT token for a new token with a new expiration date. Call the endpoint with a valid JWT token and trusted client certificate. When using the z/OSMF authentication provider, enable API Mediation Layer for PassTicket generation and configure the z/OSMF APPLID.
For more information, see Configure Passtickets.
- Open the file
zowe.yaml
. - Configure the following properties:
-
components.gateway.apiml.security.allowtokenrefresh: true
Add this property to enable the refresh endpoint. -
components.gateway.apiml.security.zosmf.applid
If you use z/OSMF as an authentication provider, provide a validAPPLID
. The API ML generates a PassTicket for the specifiedAPPLID
and subsequently uses this PassTicket to authenticate to z/OSMF. The default value in the installation of z/OSMF isIZUDFLT
.
Problems have been noted with the functionality of the property components.gateway.apiml.security.allowtokenrefresh
. For more information about the bug, see issue #3468 in the api-layer repo.
We recommend you use the following workaround:
- Configure the following parameter in
environments
:
zowe:
environments:
APIML_SECURITY_ALLOWTOKENREFRESH: true
- Restart Zowe.
Authorization
Authorization is used to set the access rights of an entity.
In the API ML, authorization is performed by any of the following z/OS security managers:
An authentication token is used as proof of valid authentication. The authorization checks, however, are always performed by the z/OS security manager.
Additional customizable properties when using JWT tokens
You can also customize the following properties when authenticating with a JWT token:
-
components.gateway.apiml.security.auth.zosmf.ServiceId
This parameter specifies the z/OSMF service id used as authentication provider. The service id is defined in the static definition of z/OSMF. The default value iszosmf
. -
components.gateway.apiml.security.auth.tokenProperties.expirationInSeconds
This property is relevant only when the JWT is generated by the API Mediation Layer and specifies to the time before expiration.API ML generation of the JWT occurs in the following cases:
- z/OSMF is only available as an older version which does not support JWT tokens
- The SAF provider is used
To use a custom configuration for z/OSMF which changes the expiration of the LTPA token, it is necessary to also set the expiration in this parameter.