import { CookieJar } from 'tough-cookie'; import { IamAccessToken } from './model/iamAccessToken'; import { OidcParams } from './model/oidcParams'; /** * This class is used for calling the IAM. */ export default class Service { private readonly iamClientId; private readonly iamUrl; private readonly PROTOCOL_AUTH; private readonly USER_TOKEN; private readonly LOGOUT; private readonly QUERY_CLIENT_ID; private readonly QUERY_REDIRECT_URI; static readonly QUERY_NONCE: string; private readonly QUERY_SCOPE; private readonly QUERY_RESPONSE_TYPE; private readonly QUERY_STATE; static readonly QUERY_HTOIDTXID: string; private readonly QUERY_SESSION_STATE; private readonly QUERY_CODE; private readonly GRANT_TYPE_AUTHZ; /** * Constructor - Initialise variables and object * @param iamRealm The name of the IAM realm for OIDC * @param iamClientId The clientId that is configured in the realm * @param iamUrl */ constructor(iamRealm: string, iamClientId: string, iamUrl: string); /** * This method is used to create a transaction for the start of an OIDC flow * @param redirectUri The initial redirect url * @param cookieJar * @returns A Promise containing the OidcParams that will be used to end the OIDC flow */ startOidcAuthenticateFlow(redirectUri: string, cookieJar: CookieJar): Promise; /** * This is used to close out the initial transaction with the IAM and exchange tokens to get a valid JWT * @param params Collected parameters from the inital and previous calls * @param accessToken The access token from the Landing Page call * @param redirectUri Our final resting place if everything is successful * @param cookieJar * @returns A Promise to an access token */ endOidcAuthenticateFlow(params: OidcParams, accessToken: string, redirectUri: string, cookieJar: CookieJar): Promise; /*** * Method to handle the error while doing API calls * * @param apiCall Represents API calls made on Haventec IAM */ private executeCall; /** * This is used to logout of the IAM * @param iamIdToken The access token that was returned during a login process */ logout(iamIdToken: string): Promise; /** * Helper method to conver the URL parameters into an object for easy reference * @param query The URL which contains the query parameters * @param targetHost The calling host that the query parameters were passed * @returns An OidcParams object containing the a specific set of query parameters */ private parseOidcParams; /** * This is used lookup a query and throw an exception if it is not found. * @param query * @param name */ private getRequiredQuery; /** * This is used to convert the access token between the IAM and LP into a JWT * @param query The url query parameters from previous calls * @param redirectUri The final resting place if authentication is successful * @returns A Promise to the access token */ private getAccessToken; } //# sourceMappingURL=service.d.ts.map