- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class ::nsmcp::BearerAuthenticator
::nsmcp::BearerAuthenticatorOnly the table name enters the blueprint. Credential records live in nsv.create ... \
[ -store:required store:required ]
Defined in /usr/local/ns/tcl/nsmcp/security.tcl
Class Relations
Methods (to be applied on instances)
authenticate (scripted, public)
<instance of nsmcp::BearerAuthenticator> authenticate \ authorization server
Authenticate a bearer header for the selected server. Validate token syntax, resolve its digest and check expiry before creating a request-owned context.
- Parameters:
- authorization (required)
- Authorization header supplied by the caller.
- server (required)
- Selected NaviServer virtual-server name.
- Returns:
- A RequestContext object, or an HTTP 401 error on rejection.
- Testcases:
- No testcase defined.
credentialInfo (scripted, public)
<instance of nsmcp::BearerAuthenticator> credentialInfo digest
Read retained metadata for a credential digest. Return only the digest-indexed grant record, never a bearer token.
- Parameters:
- digest (required)
- Hexadecimal SHA-256 credential digest.
- Returns:
- The credential record, or an empty result when it is absent.
- Testcases:
- No testcase defined.
grant (scripted, public)
<instance of nsmcp::BearerAuthenticator> grant token principal \ permissions targets expires
Grant a supplied bearer token to a principal and target set. Validate token length and expiry, then store the digest-indexed grant without retaining the token itself.
- Parameters:
- token (required)
- High-entropy bearer token; only its digest is retained.
- principal (required)
- Authenticated principal identifier.
- permissions (required)
- Explicit permission names granted to the credential.
- targets (required)
- Server names which the credential may target.
- expires (required)
- Expiry timestamp in epoch seconds, or zero for no expiry.
- Returns:
- The hexadecimal token digest.
- Testcases:
- No testcase defined.
issue (scripted, public)
<instance of nsmcp::BearerAuthenticator> issue principal \ permissions targets expires
Create and grant a new bearer credential. Generate a high-entropy token, store only its digest and grants, and return the secret to the administrator once.
- Parameters:
- principal (required)
- Authenticated principal identifier.
- permissions (required)
- Explicit permission names granted to the credential.
- targets (required)
- Server names which the credential may target.
- expires (required)
- Expiry timestamp in epoch seconds, or zero for no expiry.
- Returns:
- A dictionary containing token, digest and expires.
- Testcases:
- No testcase defined.
revoke (scripted, public)
<instance of nsmcp::BearerAuthenticator> revoke digest
Revoke a digest-indexed credential. Remove the retained grant if present; do not require the original bearer token.
- Parameters:
- digest (required)
- Hexadecimal SHA-256 credential digest.
- Returns:
- The shared-store deletion result.
- Testcases:
- No testcase defined.
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
![[i]](/resources/acs-subsite/ZoomIn16.gif)