import type * as AuthenticationContext from 'adal-angular'; import type SPHttpClient from '../spHttpClient/SPHttpClient'; import type { IAadTokenProviderConfiguration } from './IAadTokenProvider'; /** * Options for fetching a token * * @internal */ export interface IGetTokenOptions { useCachedToken?: boolean; claims?: string; authenticationScheme?: IAuthenticationScheme; resourceRequestMethod?: string; shrClaims?: string; /** * @internal */ scopes?: string[]; /** * Qos name passed from caller * @internal */ callersQosName?: string; } /** * Options for getting token data. * @internal */ export interface IGetTokenDataOptions { useCachedToken?: boolean; skipLoggingAndDisableRedirects?: boolean; claims?: string; authenticationScheme?: IAuthenticationScheme; resourceRequestMethod?: string; shrClaims?: string; scopes?: string[]; isEnsureRequest?: boolean; callersQosName?: string; cancelRedirect?: boolean; } /** * Options for Authentication Scheme * * @public */ export declare enum IAuthenticationScheme { BEARER = "Bearer", POP = "pop" } /** * This class allows a developer to obtain OAuth2 tokens from Azure AD. * * OAuth2 tokens are used to authenticate the user from the SharePoint page * to other services such as PowerBI, Sway, Exchange, Yammer, etc. * * @remarks * AadTokenProvider is replacing the /_api.SP.OAuth.Token/Acquire endpoint * for authentication with ADAL.js. At some point in the near future, when Azure AD v2.0 * can support the same scenarios as the original version, we will switch to MSAL. * * @internal */ export interface ITokenProvider { /** * Fetches the AAD OAuth2 token for a resource if the user that's currently logged in has * access to that resource. * * The OAuth2 token SHOULD NOT be cached by the caller since it is already cached by the method * itself. * * An example of a resourceEndpoint would be https://sdfpilot.outlook.com * * @param resourceEndpoint - the resource for which the token should be obtained * @returns A promise that will be fulfilled with the token or that will reject * with an error message */ getToken(resourceEndpoint: string, options?: IGetTokenOptions): Promise; getToken(resourceEndpoint: string, useCachedToken?: boolean): Promise; _ensureState(): Promise; _ensureTelemetry(): Promise; } /** * This class allows a developer to obtain OAuth2 token and its associated data from Azure AD. * * @internal */ export interface ITokenDataProvider extends ITokenProvider { getTokenData(resourceEndpoint: string, options?: IGetTokenDataOptions): Promise; getTokenData(resourceEndpoint: string, useCachedToken?: boolean, skipLoggingAndDisableRedirects?: boolean): Promise; } /** * Parameters necessary for performing the OBO flow with SharePoint. * * @internal */ export interface ISPOBOFlowParameters { spHttpClient: SPHttpClient; serverRelativeUrl: string; } /** * Callback to get a token for the OBO exchange. * * @internal */ export type OBOTokenFunction = (claims?: string[], refresh?: boolean) => Promise; /** * Callback to get a 3P token for the OBO exchange. * @internal */ export type _OBO3PTokenFunction = (appId: string, claims?: string[], refresh?: boolean) => Promise; /** * Class for managing multiple instances of the authentication context. * * @internal */ export interface IAdalAuthContextManager { getOboTokenProvider(tokenProviderConfiguration: IAadTokenProviderConfiguration, sharePointOBOProviderConfiguration: ISPOBOFlowParameters, oboFirstPartyTokenCallback?: OBOTokenFunction, oboThirdPartyTokenCallback?: _OBO3PTokenFunction): ITokenProvider; getAdalTokenProvider(tokenProviderConfiguration: IAadTokenProviderConfiguration): ITokenProvider; } /** * Interface for interacting with internals of ADAL.js * * @internal */ export interface IAuthenticationContextInternal extends AuthenticationContext { _loginInProgress: boolean; CONSTANTS: any | { ID_TOKEN: string; STORAGE: { ERROR: string; LOGIN_REQUEST: string; LOGIN_ERROR: string; NONCE_IDTOKEN: string; STATE_LOGIN: string; }; }; RESPONSE_TYPE: any | { TOKEN: string; ID_TOKEN_TOKEN: string; }; _singletonInstance: AuthenticationContext | undefined; _user: AuthenticationContext.UserInfo; _addAdalFrame(iframeId: string): HTMLIFrameElement | undefined; _createUser(hash: string): AuthenticationContext.UserInfo; handleWindowCallback(hash?: string): void; _extractIdToken(token: string): IDecodedJWTAccessToken; _getItem(storageConstant: string): string; _getNavigateUrl(responseType: string, resourceEndpoint: string | undefined): string; _loadFrame(urlNavigate: string, frameName: string): void; _saveItem(storageConstant: string, object: string, preserve?: boolean): boolean; _renewToken(resource: string, callback: (message: string, token: string) => void, responseType: string): void; _renewIdToken(callback: (message: string, token: string) => void, responseType?: string): void; } /** * Interface for a decrypted JWT Access Token. * * @internal */ export interface IDecodedJWTAccessToken { /** * ID of the Application that requested the access token */ appid: string; /** * ID of the AAD user that requested the access token */ oid: string; } /** * Interface for a return an access token and data associated with it. * * @internal */ export interface ITokenData { accessToken: string; expiresOn: Date | null; fromCache: boolean; } //# sourceMappingURL=ITokenProvider.d.ts.map