@sap/xssec
Version:
XS Advanced Container Security API for node.js
54 lines • 3.12 kB
TypeScript
export = IdentityServiceSecurityContext;
/**
* @typedef {import('../service/IdentityService')} IdentityService
* @typedef {import('../token/IdentityServiceToken')} IdentityServiceToken
* @typedef {import('../util/Types').SecurityContextConfig} SecurityContextConfig
*/
/** @extends {SecurityContext<IdentityService, IdentityServiceToken>} */
declare class IdentityServiceSecurityContext extends SecurityContext<import("../service/IdentityService"), import("../token/IdentityServiceToken")> {
/**
* @param {IdentityService|null} service
* @param {IdentityServiceToken} token
* @param {SecurityContextConfig} [contextConfig]
*/
constructor(service: IdentityService | null, token: IdentityServiceToken, contextConfig?: SecurityContextConfig);
/**
* An XsuaaSecurityContext that may be available if an XsuaaLegacyExtension instance has been configured.
* @type {import("./XsuaaSecurityContext")}
*/
xsuaaContext: import("./XsuaaSecurityContext");
/**
* Returns the service plans of the consumer application.
* This method is only available if the context was created from an app2service token and a service with proof token validation enabled.
* @returns {string[]}
*/
get servicePlans(): string[];
/**
* This method returns an OAuth id token for the user of the given validated token.
* If the token is already an id token, it is returned as is.
* If the token is from a technical user, an error is thrown.
* If the token is an access token, it is exchanged for an id token.
*
* Subsequent calls with access tokens will return a cached id token if it is still valid for at least 5min.
* The cache size (default: 100) can be configured inside the `idTokenCache` service configuration property.
*
* @param {import("../util/Types").TokenFetchOptions & import("../util/Types").IdentityServiceTokenFetchOptions} [options] - custom token fetch options
* @returns {Promise<string>} - the id token as raw jwt string
* @throws {Error} if the token is from a technical user
*/
getIdToken(options?: import("../util/Types").TokenFetchOptions & import("../util/Types").IdentityServiceTokenFetchOptions): Promise<string>;
/**
* Checks whether the token from which this context was created is a token fetched by the OAuth 2.0 client for internal use.
* This method requires the IdentityService instance to have x5t validation enabled.
* @returns {boolean} true if the token was fetched via client credentials flow with the credentials of this context's IdentityService instance, false otherwise.
*/
isInternal(): boolean;
}
declare namespace IdentityServiceSecurityContext {
export { IdentityService, IdentityServiceToken, SecurityContextConfig };
}
import SecurityContext = require("./SecurityContext");
type IdentityService = import("../service/IdentityService");
type IdentityServiceToken = import("../token/IdentityServiceToken");
type SecurityContextConfig = import("../util/Types").SecurityContextConfig;
//# sourceMappingURL=IdentityServiceSecurityContext.d.ts.map