authorization {
rest {
// Override the built-in bearer implementation
bearer {
implementation {
request.header("Authorization", "Bearer " + decrypt(configuration.restTokenValue))
}
}
// Prefer bearer over basic when both are configured
preference(BearerTokenAuthorization)
}
scim {
basic {
implementation { /* ... */ }
}
}
}
Authentication & authorization
The SCIMREST framework authenticates against the target system per protocol namespace:
-
rest— the REST API (propertiesrest*, scriptsauthorization { rest { … } }) -
scim— the SCIM API (propertiesscim*, scriptsauthorization { scim { … } })
The two namespaces are independent: you can authenticate the SCIM API with one method and the REST API with another.
This document is part of the SCIMREST connector tutorial. See link for other topics.
SCIM support is enabled only when a scimBaseUrl is configured and SCIM credentials are present; otherwise the SCIM context is not initialized and the connector works REST-only (with a log entry noting this).
|
Supported methods
Nine authentication methods are implemented per protocol namespace:
| Method | DSL keyword | Mechanism |
|---|---|---|
Basic |
|
|
Bearer token |
|
|
JWT bearer |
|
Self-signed JWT (HS/RS/PS/ES families); placed in the |
API key |
|
Header |
OAuth 2.0 client credentials |
|
Client credentials grant (RFC 6749 §4.4) |
OAuth 2.0 password |
|
Resource owner password grant (RFC 6749 §4.3) |
OAuth 2.0 JWT bearer |
|
Client JWT assertion (RFC 7523) |
OAuth 2.0 SAML |
|
SAML assertion to the token endpoint |
AWS Signature |
|
AWS Signature Version 4 |
digest, hawk, and ntlm have configuration properties (below) but are not implemented yet — configuring them has no effect on requests.
|
Configuration properties
The generic connectors expose the full property set (see shipped connectors for how a connector hides the parts it does not need). All properties have a scim* twin with identical semantics.
Endpoints and transport
| Property | Type | Description |
|---|---|---|
|
String |
Base URL of the REST API endpoint (e.g. |
|
String |
Base URL of the SCIM endpoint (e.g. |
|
String |
Relative path used to verify connectivity on |
|
Boolean |
Trust all TLS certificates |
|
Integer |
HTTP request timeout in seconds; default |
Basic
restUsername (String), restPassword (GuardedString).
Bearer token
restTokenValue (GuardedString) — static bearer token; restTokenName (String) — prefix placed before the token value in the Authorization header (e.g. Bearer).
JWT bearer
restJwtTokenName (String) — the Authorization scheme prefix or query-parameter name; restJwtAlgorithm (String) — signing algorithm (HS256/384/512 HMAC, RS256/384/512 / PS256/384/512 RSA, ES256/384/512 ECDSA); restJwtSecret (GuardedString) — HMAC secret or PEM-encoded PKCS#8 private key; restJwtSecretBase64Encoded (Boolean) — Base64-decode the HMAC secret before signing; restJwtPayload (String) — JSON object with additional claims; restJwtLocation (String) — header (default) or query.
API key
restApiKey (GuardedString) — the key value; restApiKeyName (String) — header or query-parameter name (e.g. X-API-Key); restApiKeyLocation (String) — header (default) or query.
OAuth 2.0 (all four grant types)
| Property | Type | Description |
|---|---|---|
|
String |
URL of the authorization server token endpoint |
|
String |
Client identifier |
|
GuardedString |
Client secret (required for client credentials) |
|
String |
Space-separated list of scopes to request |
|
String |
How client credentials are sent to the token endpoint: |
|
String |
Resource owner username (password grant) |
|
GuardedString |
Resource owner password (password grant) |
|
GuardedString |
PEM-encoded PKCS#8 private key for the JWT bearer grant (RFC 7523) |
|
String |
Issuer identifier used as the |
|
String |
Key ID ( |
|
String |
JWT signing algorithm for the assertion (e.g. |
|
String |
Subject ( |
OAuth 2.0 behavior fixed by the framework: the token field in the token response is always access_token (missing field → error), the aud claim of the JWT assertion is the token URL, and iss / sub default to the client ID.
AWS Signature
restAwsAccessKey (String), restAwsSecretKey (GuardedString), restAwsSessionToken (GuardedString) — temporary session token; restAwsRegion (String), restAwsService (String) — service name used in the signature scope (e.g. execute-api, s3).
Digest, Hawk, NTLM (configuration only, not implemented)
restDigestUsername, restDigestPassword, restDigestAutoChallenge, restDigestMaxRetries, restDigestPreemptiveAuth, restDigestAlgorithmPreference, restDigestStateCacheEnabled;
restHawkId, restHawkKey, restHawkAlgorithm (sha256 default / sha512), restHawkIncludePayloadHash, restHawkOffset, restHawkExt;
restNtlmUsername, restNtlmPassword, restNtlmDomain, restNtlmWorkstation, restNtlmVersion (NTLMv2 default).
Script customization
Authentication can be customized per method in a Groovy script (bundled via the manifest’s authorization section, or written inline in a connector class):
-
implementation { … }— replaces the built-in behavior of the method. The closure delegate exposes:configuration()(the connector configuration),request()(theHttpRequestSpecificationbeing customized),ctx()(a key/value context,set/get),decrypt(String)(decrypts guarded values),newRequest(url),newJwt(…),execute(spec)(runs an HTTP request), andparseJson(…). -
preference(…)— the preferred method when several are configured.
The same customization in YAML (a top-level authentication block, in the same file as the operation documents):
authentication:
rest:
bearer:
implementation: |
request.header("Authorization", "Bearer " + decrypt(configuration.restTokenValue))
preference:
- bearer
scim:
basic:
implementation: |
# ...
See declarative YAML for the full reference.
OAuth 2.0 hooks
The OAuth 2.0 methods accept fine-grained hooks:
| Hook | Argument | Purpose |
|---|---|---|
|
the token-endpoint request |
customize the token request |
|
the token response as a map |
parse non-standard responses (the context must then contain |
|
— |
return |
|
the request being authorized |
attach the token to the request |
|
the HTTP response |
fires on every response after an authorized request; by default a 401 clears the cached token — providing a hook replaces that default |
AWS beforeSign hook
awsSignature { beforeSign { … } } — the closure receives the request and can set a custom sign header via signHeader(name); getRequest() returns the HttpRequestSpecification.
No credentials
If no authentication method is configured for a namespace, requests in that namespace are sent without authentication headers. The SCIM namespace is disabled entirely unless scimBaseUrl and at least one SCIM credential are present (see the note above).