...
This authentication type is mostly used as part of OAuth 2.0 authentication flow.
At first you need your client needs to obtain the Bearer token from an OAuth2 exchange flow on an OAuth2 server where the login credentials will be exchanged to a Bearer token.Then. Then you can use this Bearer token in the HTTP header to authenticate PIPEFORCE command and other endpoint calls.
This approach needs good knowledge how OAuth2 works which is out of scope of this documentation.
Once you finally have obtained the access token form your OAuth2 exchange flow, you can set the it as Bearer token like this:
Code Block |
---|
authorization: Bearer <token> |
Here is an example of how you can could obtain the Bearer access token from the PIPEFORCE IAM service :for the client-id pipeforce
.
Code Block |
---|
export TOKEN_RESPONSE=`curl -X POST --location "https://iam-<ns>.pipeforce.net/auth/realms/<ns>/protocol/openid-connect/token" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "grant_type=password&client_id=pipeforce&username=<username>&password=<password>&scope=pipeforce"` export PIPEFORCE_ACCESS_TOKEN=`echo $TOKEN_RESPONSE | jq -r '.access_token'` curl "https://hub-<ns>.pipeforce.net/api/v3/command/..." -H -H "authorization: Bearer ${PIPEFORCE_ACCESS_TOKEN}" |
RunAs Authentication
This is not really an authentication method since it switches from an already successfully authenticated user to another user in case the user has the permission to do so.
This method works only in case there is already a successfully authenticated user in the current request scope and it is allowed for this user to run as:
...
In case you need to setup a custom OAuth2 client-id and secret in PIPEFORCE IAM, please contact support since they will setup and maintain this for you.
Refresh Authentication
This authenticates using a refresh token from an OAuth 2.0 flow.
...