Through the Admin Interface
To set up OAuth-based authentication and authorization with Amazon Cognito through the Admin Interface, follow these steps:
Create your external security object by setting these fields on the External Security configuration page and clicking OK:
Field
Setting
External Security Name
Enter a descriptive name for this external security object that identifies the external agent.
EXAMPLE:
AmazonCognitoExampleOAuth
Description
(Optional) Enter a description for this external security object.
EXAMPLE:
Amazon Cognito external security object for OAuth
Authentication
Choose
oauth
from the dropdown.[v11.2.0 and up] Setting this field to
oauth
makes the OAuth Server fields available.Cache Timeout
Enter a number in seconds after which you want MarkLogic Server to re-authenticate the user with your OAuth external agent instead of with the credentials stored in the cache.
EXAMPLE:
300
(default kept)Note
Clear the cache by calling sec:external-security-clear-cache().
Authorization
Choose
oauth
from the dropdown.OAuth Server fields:
Field
Setting
OAuth Flow Type
Choose
Resource server
from the dropdown.OAuth Vendor
Choose
Amazon Cognito
from the dropdown.OAuth Client ID
Enter the app client id on your User Pool Application Integration application’s overview page.
EXAMPLE:
19vomjilg46bbvcpp9qcmeacoc
OAuth JWT Issuer URI
Required: Find the user pool ID from your Amazon Cognito user pool page and construct the JWT issuer URI like this:
https://cognito-idp.
<region>.amazonaws.com/
<userpoolID>EXAMPLE (with user pool ID of
us-east-1_fMQqTCMd9
):https://cognito-idp.us-east-1.amazonaws.com/us-east-1_fMQqTCMd9
OAuth Token Type
Choose
JSON Web Tokens
from the dropdown.OAuth Username Attribute
username
OAuth Role Attribute
cognito:groups
OAuth JWT Algorithm
Choose
RS256
from the dropdown.OAuth JWT Secrets
Enter the key ID into the left field as the Secret Key ID and the public key in PEM format into the right field as the Secret Value.
To enter more secrets, click Add Secret to expose additional field pairs.
EXAMPLE:
Secret Key ID =
fBwvWl/oWKPB9fyhXtZ8EqAhAmljMhk4hW2dd/zpFYs=
Secret Value =
-----BEGIN PUBLIC KEY-----
<PEM-converted key>
-----END PUBLIC KEY-----
Configure your desired app servers to use this external security object by setting these fields on each App Server configuration page and clicking OK:
Field
Setting
Authentication
Choose
oauth
from the dropdown.Internal Security
Click the
false
radio button.External Securities dropdown
Choose from the dropdown the External Security Name that you gave to your external security object in the previous step. Choose only one.
EXAMPLE:
AmazonCognitoExampleOAuth
Assign the external name to your desired roles by setting this field on each Role configuration page and clicking OK:
Field
Setting
External Name
Enter the group name from the user pool page Groups panel that corresponds to this MarkLogic Server role.
EXAMPLE:
GroupFoo
MarkLogic Server is now set up for OAuth-based authentication and authorization with Amazon Cognito.