148 lines
5.4 KiB
TypeScript
148 lines
5.4 KiB
TypeScript
|
import { AuthorityType } from "./AuthorityType";
|
||
|
import { IUri } from "../url/IUri";
|
||
|
import { INetworkModule } from "../network/INetworkModule";
|
||
|
import { ProtocolMode } from "./ProtocolMode";
|
||
|
import { ICacheManager } from "../cache/interface/ICacheManager";
|
||
|
import { AuthorityOptions } from "./AuthorityOptions";
|
||
|
import { CloudDiscoveryMetadata } from "./CloudDiscoveryMetadata";
|
||
|
/**
|
||
|
* The authority class validates the authority URIs used by the user, and retrieves the OpenID Configuration Data from the
|
||
|
* endpoint. It will store the pertinent config data in this object for use during token calls.
|
||
|
*/
|
||
|
export declare class Authority {
|
||
|
private _canonicalAuthority;
|
||
|
private _canonicalAuthorityUrlComponents;
|
||
|
protected networkInterface: INetworkModule;
|
||
|
protected cacheManager: ICacheManager;
|
||
|
private authorityOptions;
|
||
|
private metadata;
|
||
|
constructor(authority: string, networkInterface: INetworkModule, cacheManager: ICacheManager, authorityOptions: AuthorityOptions);
|
||
|
get authorityType(): AuthorityType;
|
||
|
/**
|
||
|
* ProtocolMode enum representing the way endpoints are constructed.
|
||
|
*/
|
||
|
get protocolMode(): ProtocolMode;
|
||
|
/**
|
||
|
* Returns authorityOptions which can be used to reinstantiate a new authority instance
|
||
|
*/
|
||
|
get options(): AuthorityOptions;
|
||
|
/**
|
||
|
* A URL that is the authority set by the developer
|
||
|
*/
|
||
|
get canonicalAuthority(): string;
|
||
|
/**
|
||
|
* Sets canonical authority.
|
||
|
*/
|
||
|
set canonicalAuthority(url: string);
|
||
|
/**
|
||
|
* Get authority components.
|
||
|
*/
|
||
|
get canonicalAuthorityUrlComponents(): IUri;
|
||
|
/**
|
||
|
* Get hostname and port i.e. login.microsoftonline.com
|
||
|
*/
|
||
|
get hostnameAndPort(): string;
|
||
|
/**
|
||
|
* Get tenant for authority.
|
||
|
*/
|
||
|
get tenant(): string;
|
||
|
/**
|
||
|
* OAuth /authorize endpoint for requests
|
||
|
*/
|
||
|
get authorizationEndpoint(): string;
|
||
|
/**
|
||
|
* OAuth /token endpoint for requests
|
||
|
*/
|
||
|
get tokenEndpoint(): string;
|
||
|
get deviceCodeEndpoint(): string;
|
||
|
/**
|
||
|
* OAuth logout endpoint for requests
|
||
|
*/
|
||
|
get endSessionEndpoint(): string;
|
||
|
/**
|
||
|
* OAuth issuer for requests
|
||
|
*/
|
||
|
get selfSignedJwtAudience(): string;
|
||
|
/**
|
||
|
* Replaces tenant in url path with current tenant. Defaults to common.
|
||
|
* @param urlString
|
||
|
*/
|
||
|
private replaceTenant;
|
||
|
/**
|
||
|
* Replaces path such as tenant or policy with the current tenant or policy.
|
||
|
* @param urlString
|
||
|
*/
|
||
|
private replacePath;
|
||
|
/**
|
||
|
* The default open id configuration endpoint for any canonical authority.
|
||
|
*/
|
||
|
protected get defaultOpenIdConfigurationEndpoint(): string;
|
||
|
/**
|
||
|
* Boolean that returns whethr or not tenant discovery has been completed.
|
||
|
*/
|
||
|
discoveryComplete(): boolean;
|
||
|
/**
|
||
|
* Perform endpoint discovery to discover aliases, preferred_cache, preferred_network
|
||
|
* and the /authorize, /token and logout endpoints.
|
||
|
*/
|
||
|
resolveEndpointsAsync(): Promise<void>;
|
||
|
/**
|
||
|
* Update AuthorityMetadataEntity with new endpoints and return where the information came from
|
||
|
* @param metadataEntity
|
||
|
*/
|
||
|
private updateEndpointMetadata;
|
||
|
/**
|
||
|
* Compares the number of url components after the domain to determine if the cached authority metadata can be used for the requested authority
|
||
|
* Protects against same domain different authority such as login.microsoftonline.com/tenant and login.microsoftonline.com/tfp/tenant/policy
|
||
|
* @param metadataEntity
|
||
|
*/
|
||
|
private isAuthoritySameType;
|
||
|
/**
|
||
|
* Parse authorityMetadata config option
|
||
|
*/
|
||
|
private getEndpointMetadataFromConfig;
|
||
|
/**
|
||
|
* Gets OAuth endpoints from the given OpenID configuration endpoint.
|
||
|
*/
|
||
|
private getEndpointMetadataFromNetwork;
|
||
|
/**
|
||
|
* Updates the AuthorityMetadataEntity with new aliases, preferred_network and preferred_cache and returns where the information was retrived from
|
||
|
* @param cachedMetadata
|
||
|
* @param newMetadata
|
||
|
*/
|
||
|
private updateCloudDiscoveryMetadata;
|
||
|
/**
|
||
|
* Parse cloudDiscoveryMetadata config or check knownAuthorities
|
||
|
*/
|
||
|
private getCloudDiscoveryMetadataFromConfig;
|
||
|
/**
|
||
|
* Called to get metadata from network if CloudDiscoveryMetadata was not populated by config
|
||
|
* @param networkInterface
|
||
|
*/
|
||
|
private getCloudDiscoveryMetadataFromNetwork;
|
||
|
/**
|
||
|
* Helper function to determine if this host is included in the knownAuthorities config option
|
||
|
*/
|
||
|
private isInKnownAuthorities;
|
||
|
/**
|
||
|
* Creates cloud discovery metadata object from a given host
|
||
|
* @param host
|
||
|
*/
|
||
|
static createCloudDiscoveryMetadataFromHost(host: string): CloudDiscoveryMetadata;
|
||
|
/**
|
||
|
* Searches instance discovery network response for the entry that contains the host in the aliases list
|
||
|
* @param response
|
||
|
* @param authority
|
||
|
*/
|
||
|
static getCloudDiscoveryMetadataFromNetworkResponse(response: CloudDiscoveryMetadata[], authority: string): CloudDiscoveryMetadata | null;
|
||
|
/**
|
||
|
* helper function to generate environment from authority object
|
||
|
*/
|
||
|
getPreferredCache(): string;
|
||
|
/**
|
||
|
* Returns whether or not the provided host is an alias of this authority instance
|
||
|
* @param host
|
||
|
*/
|
||
|
isAlias(host: string): boolean;
|
||
|
}
|
||
|
//# sourceMappingURL=Authority.d.ts.map
|