import { FullAuthUtil } from './baseAuthUtils'; import { Auth } from '../../generators/postman/definitions'; import { SecurityRequirementObject, SecuritySchemeObject } from '../../generators/openapi/definitions'; export declare enum ClientAuthentication { body = "body", header = "header" } export declare enum GrantType { authorizationCode = "authorization_code", authorizationCodeWithPkce = "authorization_code_with_pkce", implicit = "implicit", passwordCredentials = "password_credentials", clientCredentials = "client_credentials" } export declare enum TokenLocation { queryParams = "queryParams", header = "header" } export declare enum ChallengeAlgorithm { plain = "plain", S256 = "S256" } /** * {@include ../../../typedocIncludes/auth/oAuth2Util.md} */ export declare class OAuth2Util extends FullAuthUtil { protected clientAuthentication?: string; protected state?: string; protected scopes: Record; protected clientSecret?: string; protected clientId?: string; protected accessTokenUrl?: string; protected authUrl?: string; protected useBrowser?: boolean; protected redirectUri?: string; protected grantType?: string; protected tokenLocation?: string; protected tokenName?: string; protected headerPrefix?: string; protected codeVerifier?: string; protected challengeAlgorithm?: string; protected password?: string; protected username?: string; protected refreshUrl?: string; /** * Very optional. * If set, it will be used for postman, concatenating accessTokenUrl and authUrl. */ protected host?: string; setDescription(description: string): this; /** * Send as Basic Auth header */ clientAuthenticationToHeader(): this; /** * Send client credentials to body */ clientAuthenticationToBody(): this; /** * * @param clientAuthentication Send client credentials to body * or as Basic Auth header * @returns */ setClientAuthentication(clientAuthentication: ClientAuthentication): this; setClientAuthentication(clientAuthentication: string): this; getClientAuthentication(): string | undefined; removeClientAuthentication(): string | undefined; /** * * @param state An opaque value that is used for * preventing cross-site request forgery. * @returns */ setState(state: string): this; getState(): string | undefined; removeState(): string | undefined; /** * * @param scopes The scopes of the access request. * A map between the scope name and a short description for it. The map MAY be empty. * @returns */ setScopes(scopes: Record): this; getScopes(): Record; removeScopes(): Record; addScope(scope: string, description?: string): this; getScopesNames(): string[]; setClientSecret(clientSecret: string): this; getClientSecret(): string | undefined; removeClientSecret(): string | undefined; setClientId(clientId: string): this; getClientId(): string | undefined; removeClientId(): string | undefined; setHost(host: string): this; getHost(): string | undefined; removeHost(): string | undefined; /** * * @param accessTokenUrl The endpoint for authentication server. * This is used to exchange the authorization code for an access token. * @returns */ setAccessTokenUrl(accessTokenUrl: string): this; getAccessTokenUrl(): string | undefined; removeAccessTokenUrl(): string | undefined; /** * * @param authUrl The endpoint for the authorization server. * This is used to get the authorization code. * @returns */ setAuthUrl(authUrl: string): this; getAuthUrl(): string | undefined; removeAuthUrl(): string | undefined; /** * * @param useBrowser If true, authorize using browser. * @returns */ setUseBrowser(useBrowser: boolean): this; getUseBrowser(): boolean | undefined; removeUseBrowser(): boolean | undefined; /** * * @param redirectUri This is the callback URL that you will be * redirected to, after your application is authorized. * @returns */ setRedirectUri(redirectUri: string): this; getRedirectUri(): string | undefined; removeRedirectUri(): string | undefined; setGrantType(grantType: GrantType): this; setGrantType(grantType: string): this; getGrantType(): string | undefined; removeGrantType(): string | undefined; setTokenLocation(tokenLocation: TokenLocation): this; setTokenLocation(tokenLocation: string): this; getTokenLocation(): string | undefined; removeTokenLocation(): string | undefined; setTokenName(tokenName: string): this; getTokenName(): string | undefined; removeTokenName(): string | undefined; /** * * @param headerPrefix Added to the Authorization header before the access token. * @returns */ setHeaderPrefix(headerPrefix: string): this; getHeaderPrefix(): string | undefined; removeHeaderPrefix(): string | undefined; /** * * @param codeVerifier A random, 43-128 character string used to * connect the authorization request to the token request. * @returns */ setCodeVerifier(codeVerifier: string): this; getCodeVerifier(): string | undefined; removeCodeVerifier(): string | undefined; /** * * @param challengeAlgorithm Algoritm used for generating the Code Challenge. */ setChallengeAlgorithm(challengeAlgorithm: ChallengeAlgorithm): this; setChallengeAlgorithm(challengeAlgorithm: string): this; getChallengeAlgorithm(): string | undefined; removeChallengeAlgorithm(): string | undefined; setPassword(password: string): this; getPassword(): string | undefined; removePassword(): string | undefined; setUsername(username: string): this; getUsername(): string | undefined; removeUsername(): string | undefined; setRefreshUrl(refreshUrl: string): this; getRefreshUrl(): string | undefined; removeRefreshUrl(): string | undefined; toPostman(scopes?: string[]): Auth; toOpenAPI(): Record; toOpenAPISecurity(scopes?: string[]): SecurityRequirementObject[]; }