UNPKG

6.02 kBTypeScriptView Raw
1import * as i0 from "@angular/core";
2/**
3 * Additional options that can be passed to tryLogin.
4 */
5export declare class LoginOptions {
6 /**
7 * Is called, after a token has been received and
8 * successfully validated.
9 *
10 * Deprecated: Use property ``events`` on OAuthService instead.
11 */
12 onTokenReceived?: (receivedTokens: ReceivedTokens) => void;
13 /**
14 * Hook, to validate the received tokens.
15 *
16 * Deprecated: Use property ``tokenValidationHandler`` on OAuthService instead.
17 */
18 validationHandler?: (receivedTokens: ReceivedTokens) => Promise<any>;
19 /**
20 * Called when tryLogin detects that the auth server
21 * included an error message into the hash fragment.
22 *
23 * Deprecated: Use property ``events`` on OAuthService instead.
24 */
25 onLoginError?: (params: object) => void;
26 /**
27 * A custom hash fragment to be used instead of the
28 * actual one. This is used for silent refreshes, to
29 * pass the iframes hash fragment to this method, and
30 * is also used by popup flows in the same manner.
31 * This can be used with code flow, where is must be set
32 * to a hash symbol followed by the querystring. The
33 * question mark is optional, but may be present following
34 * the hash symbol.
35 */
36 customHashFragment?: string;
37 /**
38 * Set this to true to disable the oauth2 state
39 * check which is a best practice to avoid
40 * security attacks.
41 * As OIDC defines a nonce check that includes
42 * this, this can be set to true when only doing
43 * OIDC.
44 */
45 disableOAuth2StateCheck?: boolean;
46 /**
47 * Set this to true to disable the nonce
48 * check which is used to avoid
49 * replay attacks.
50 * This flag should never be true in
51 * production environments.
52 */
53 disableNonceCheck?: boolean;
54 /**
55 * Normally, you want to clear your hash fragment after
56 * the lib read the token(s) so that they are not displayed
57 * anymore in the url. If not, set this to true. For code flow
58 * this controls removing query string values.
59 */
60 preventClearHashAfterLogin?: boolean;
61 /**
62 * Set this for code flow if you used a custom redirect Uri
63 * when retrieving the code. This is used internally for silent
64 * refresh and popup flows.
65 */
66 customRedirectUri?: string;
67}
68/**
69 * Defines the logging interface the OAuthService uses
70 * internally. Is compatible with the `console` object,
71 * but you can provide your own implementation as well
72 * through dependency injection.
73 */
74export declare abstract class OAuthLogger {
75 abstract debug(message?: any, ...optionalParams: any[]): void;
76 abstract info(message?: any, ...optionalParams: any[]): void;
77 abstract log(message?: any, ...optionalParams: any[]): void;
78 abstract warn(message?: any, ...optionalParams: any[]): void;
79 abstract error(message?: any, ...optionalParams: any[]): void;
80}
81/**
82 * Defines a simple storage that can be used for
83 * storing the tokens at client side.
84 * Is compatible to localStorage and sessionStorage,
85 * but you can also create your own implementations.
86 */
87export declare abstract class OAuthStorage {
88 abstract getItem(key: string): string | null;
89 abstract removeItem(key: string): void;
90 abstract setItem(key: string, data: string): void;
91}
92export declare class MemoryStorage implements OAuthStorage {
93 private data;
94 getItem(key: string): string;
95 removeItem(key: string): void;
96 setItem(key: string, data: string): void;
97 static ɵfac: i0.ɵɵFactoryDeclaration<MemoryStorage, never>;
98 static ɵprov: i0.ɵɵInjectableDeclaration<MemoryStorage>;
99}
100/**
101 * Represents the received tokens, the received state
102 * and the parsed claims from the id-token.
103 */
104export declare class ReceivedTokens {
105 idToken: string;
106 accessToken: string;
107 idClaims?: object;
108 state?: string;
109}
110/**
111 * Represents the parsed and validated id_token.
112 */
113export interface ParsedIdToken {
114 idToken: string;
115 idTokenClaims: object;
116 idTokenHeader: object;
117 idTokenClaimsJson: string;
118 idTokenHeaderJson: string;
119 idTokenExpiresAt: number;
120}
121/**
122 * Represents the response from the token endpoint
123 * http://openid.net/specs/openid-connect-core-1_0.html#TokenEndpoint
124 */
125export interface TokenResponse {
126 access_token: string;
127 id_token: string;
128 token_type: string;
129 expires_in: number;
130 refresh_token: string;
131 scope: string;
132 state?: string;
133}
134/**
135 * Represents the response from the user info endpoint
136 * http://openid.net/specs/openid-connect-core-1_0.html#UserInfo
137 */
138export interface UserInfo {
139 sub: string;
140 [key: string]: any;
141}
142/**
143 * Represents an OpenID Connect discovery document
144 */
145export interface OidcDiscoveryDoc {
146 issuer: string;
147 authorization_endpoint: string;
148 token_endpoint: string;
149 token_endpoint_auth_methods_supported: string[];
150 token_endpoint_auth_signing_alg_values_supported: string[];
151 userinfo_endpoint: string;
152 check_session_iframe: string;
153 end_session_endpoint: string;
154 jwks_uri: string;
155 registration_endpoint: string;
156 scopes_supported: string[];
157 response_types_supported: string[];
158 acr_values_supported: string[];
159 response_modes_supported: string[];
160 grant_types_supported: string[];
161 subject_types_supported: string[];
162 userinfo_signing_alg_values_supported: string[];
163 userinfo_encryption_alg_values_supported: string[];
164 userinfo_encryption_enc_values_supported: string[];
165 id_token_signing_alg_values_supported: string[];
166 id_token_encryption_alg_values_supported: string[];
167 id_token_encryption_enc_values_supported: string[];
168 request_object_signing_alg_values_supported: string[];
169 display_values_supported: string[];
170 claim_types_supported: string[];
171 claims_supported: string[];
172 claims_parameter_supported: boolean;
173 service_documentation: string;
174 ui_locales_supported: string[];
175 revocation_endpoint: string;
176}