oidc-client-ts
Advanced tools
Comparing version 2.0.0-rc.2 to 2.0.0-rc.3
@@ -21,3 +21,3 @@ /** | ||
*/ | ||
export declare type AccessTokenCallback = (...ev: any[]) => void; | ||
export declare type AccessTokenCallback = (...ev: unknown[]) => void; | ||
@@ -40,3 +40,3 @@ /** | ||
*/ | ||
addAccessTokenExpiring(cb: AccessTokenCallback): void; | ||
addAccessTokenExpiring(cb: AccessTokenCallback): () => void; | ||
/** | ||
@@ -49,3 +49,3 @@ * Remove callback: Raised prior to the access token expiring. | ||
*/ | ||
addAccessTokenExpired(cb: AccessTokenCallback): void; | ||
addAccessTokenExpired(cb: AccessTokenCallback): () => void; | ||
/** | ||
@@ -119,2 +119,4 @@ * Remove callback: Raised after the access token has expired. | ||
* | ||
* See https://openid.net/specs/openid-connect-core-1_0.html#AuthError | ||
* | ||
* @public | ||
@@ -198,3 +200,3 @@ */ | ||
constructor(_settings: UserManagerSettingsStore); | ||
prepare({ silentRequestTimeoutInSeconds }: IFrameWindowParams): Promise<IFrameWindow>; | ||
prepare({ silentRequestTimeoutInSeconds, }: IFrameWindowParams): Promise<IFrameWindow>; | ||
callback(url: string): Promise<void>; | ||
@@ -210,3 +212,3 @@ } | ||
private _timeoutInSeconds; | ||
constructor({ silentRequestTimeoutInSeconds }: IFrameWindowParams); | ||
constructor({ silentRequestTimeoutInSeconds, }: IFrameWindowParams); | ||
navigate(params: NavigateParams): Promise<NavigateResponse>; | ||
@@ -230,6 +232,6 @@ close(): void; | ||
export declare interface ILogger { | ||
debug(...args: any[]): void; | ||
info(...args: any[]): void; | ||
warn(...args: any[]): void; | ||
error(...args: any[]): void; | ||
debug(...args: unknown[]): void; | ||
info(...args: unknown[]): void; | ||
warn(...args: unknown[]): void; | ||
error(...args: unknown[]): void; | ||
} | ||
@@ -279,2 +281,3 @@ | ||
auth_time?: number; | ||
[claim: string]: unknown; | ||
} | ||
@@ -309,10 +312,10 @@ | ||
constructor(name: string); | ||
debug(...args: any[]): void; | ||
info(...args: any[]): void; | ||
warn(...args: any[]): void; | ||
error(...args: any[]): void; | ||
static debug(name: string, ...args: any[]): void; | ||
static info(name: string, ...args: any[]): void; | ||
static warn(name: string, ...args: any[]): void; | ||
static error(name: string, ...args: any[]): void; | ||
debug(...args: unknown[]): void; | ||
info(...args: unknown[]): void; | ||
warn(...args: unknown[]): void; | ||
error(...args: unknown[]): void; | ||
static debug(name: string, ...args: unknown[]): void; | ||
static info(name: string, ...args: unknown[]): void; | ||
static warn(name: string, ...args: unknown[]): void; | ||
static error(name: string, ...args: unknown[]): void; | ||
} | ||
@@ -378,3 +381,3 @@ | ||
constructor(settings: OidcClientSettings); | ||
createSigninRequest({ response_type, scope, redirect_uri, state, prompt, display, max_age, ui_locales, id_token_hint, login_hint, acr_values, resource, request, request_uri, response_mode, extraQueryParams, extraTokenParams, request_type, skipUserInfo }: CreateSigninRequestArgs): Promise<SigninRequest>; | ||
createSigninRequest({ response_type, scope, redirect_uri, state, prompt, display, max_age, ui_locales, id_token_hint, login_hint, acr_values, resource, request, request_uri, response_mode, extraQueryParams, extraTokenParams, request_type, skipUserInfo, }: CreateSigninRequestArgs): Promise<SigninRequest>; | ||
readSigninResponseState(url: string, removeState?: boolean): Promise<{ | ||
@@ -385,3 +388,3 @@ state: SigninState; | ||
processSigninResponse(url: string): Promise<SigninResponse>; | ||
createSignoutRequest({ state, id_token_hint, post_logout_redirect_uri, extraQueryParams, request_type }?: CreateSignoutRequestArgs): Promise<SignoutRequest>; | ||
createSignoutRequest({ state, id_token_hint, post_logout_redirect_uri, extraQueryParams, request_type, }?: CreateSignoutRequestArgs): Promise<SignoutRequest>; | ||
readSignoutResponseState(url: string, removeState?: boolean): Promise<{ | ||
@@ -458,3 +461,3 @@ state: State | undefined; | ||
/** | ||
* Storage object used to persist interaction state (default: local storage). | ||
* Storage object used to persist interaction state (default: window.localStorage, InMemoryWebStorage iff no window). | ||
* E.g. `stateStore: new WebStorageStateStore({ store: window.localStorage })` | ||
@@ -505,4 +508,4 @@ */ | ||
readonly extraQueryParams: Record<string, string | number | boolean>; | ||
readonly extraTokenParams: Record<string, any>; | ||
constructor({ authority, metadataUrl, metadata, signingKeys, metadataSeed, client_id, client_secret, response_type, scope, redirect_uri, post_logout_redirect_uri, client_authentication, prompt, display, max_age, ui_locales, acr_values, resource, response_mode, filterProtocolClaims, loadUserInfo, staleStateAgeInSeconds, clockSkewInSeconds, userInfoJwtIssuer, mergeClaims, stateStore, extraQueryParams, extraTokenParams }: OidcClientSettings); | ||
readonly extraTokenParams: Record<string, unknown>; | ||
constructor({ authority, metadataUrl, metadata, signingKeys, metadataSeed, client_id, client_secret, response_type, scope, redirect_uri, post_logout_redirect_uri, client_authentication, prompt, display, max_age, ui_locales, acr_values, resource, response_mode, filterProtocolClaims, loadUserInfo, staleStateAgeInSeconds, clockSkewInSeconds, userInfoJwtIssuer, mergeClaims, stateStore, extraQueryParams, extraTokenParams, }: OidcClientSettings); | ||
} | ||
@@ -608,3 +611,3 @@ | ||
constructor(_settings: UserManagerSettingsStore); | ||
prepare({ redirectMethod }: RedirectParams): Promise<IWindow>; | ||
prepare({ redirectMethod, }: RedirectParams): Promise<IWindow>; | ||
} | ||
@@ -633,3 +636,3 @@ | ||
protected _processClaims(state: SigninState, response: SigninResponse): Promise<SigninResponse>; | ||
protected _mergeClaims(claims1: UserProfile, claims2: any): UserProfile; | ||
protected _mergeClaims(claims1: UserProfile, claims2: JwtPayload): UserProfile; | ||
protected _filterProtocolClaims(claims: UserProfile): UserProfile; | ||
@@ -656,3 +659,2 @@ protected _validateTokens(state: SigninState, response: SigninResponse): Promise<SigninResponse>; | ||
private readonly _userManager; | ||
private readonly _timer; | ||
private _sub; | ||
@@ -843,3 +845,3 @@ private _sid; | ||
readonly state?: State; | ||
constructor({ url, state_data, id_token_hint, post_logout_redirect_uri, extraQueryParams, request_type }: SignoutRequestArgs); | ||
constructor({ url, state_data, id_token_hint, post_logout_redirect_uri, extraQueryParams, request_type, }: SignoutRequestArgs); | ||
} | ||
@@ -933,3 +935,3 @@ | ||
exchangeCode({ grant_type, redirect_uri, client_id, client_secret, ...args }: ExchangeCodeArgs): Promise<Record<string, unknown>>; | ||
exchangeRefreshToken({ grant_type, client_id, client_secret, ...args }: ExchangeRefreshTokenArgs): Promise<any>; | ||
exchangeRefreshToken({ grant_type, client_id, client_secret, ...args }: ExchangeRefreshTokenArgs): Promise<Record<string, unknown>>; | ||
revoke({ optional, ...args }: RevokeArgs): Promise<void>; | ||
@@ -1067,3 +1069,3 @@ } | ||
signinSilentCallback(url?: string): Promise<void>; | ||
signinCallback(url?: string): Promise<User | null>; | ||
signinCallback(url?: string): Promise<User | void>; | ||
signoutCallback(url?: string, keepOpen?: boolean): Promise<void>; | ||
@@ -1131,3 +1133,3 @@ /** | ||
*/ | ||
addUserLoaded(cb: UserLoadedCallback): void; | ||
addUserLoaded(cb: UserLoadedCallback): () => void; | ||
/** | ||
@@ -1140,3 +1142,3 @@ * Remove callback: Raised when a user session has been established (or re-established). | ||
*/ | ||
addUserUnloaded(cb: UserUnloadedCallback): void; | ||
addUserUnloaded(cb: UserUnloadedCallback): () => void; | ||
/** | ||
@@ -1149,3 +1151,3 @@ * Remove callback: Raised when a user session has been terminated. | ||
*/ | ||
addSilentRenewError(cb: SilentRenewErrorCallback): void; | ||
addSilentRenewError(cb: SilentRenewErrorCallback): () => void; | ||
/** | ||
@@ -1162,3 +1164,3 @@ * Remove callback: Raised when the automatic silent renew has failed. | ||
*/ | ||
addUserSignedIn(cb: UserSignedInCallback): void; | ||
addUserSignedIn(cb: UserSignedInCallback): () => void; | ||
/** | ||
@@ -1175,3 +1177,3 @@ * Remove callback: Raised when the user is signed in. | ||
*/ | ||
addUserSignedOut(cb: UserSignedOutCallback): void; | ||
addUserSignedOut(cb: UserSignedOutCallback): () => void; | ||
/** | ||
@@ -1188,3 +1190,3 @@ * Remove callback: Raised when the user's sign-in status at the OP has changed. | ||
*/ | ||
addUserSessionChanged(cb: UserSessionChangedCallback): void; | ||
addUserSessionChanged(cb: UserSessionChangedCallback): () => void; | ||
/** | ||
@@ -1241,3 +1243,3 @@ * Remove callback: Raised when the user session changed (when `monitorSession` is set) | ||
/** | ||
* Storage object used to persist User for currently authenticated user (default: session storage). | ||
* Storage object used to persist User for currently authenticated user (default: window.sessionStorage, InMemoryWebStorage iff no window). | ||
* E.g. `userStore: new WebStorageStateStore({ store: window.localStorage })` | ||
@@ -1277,5 +1279,9 @@ */ | ||
/** | ||
* Holds claims represented by a combination of the `id_token` and the user info endpoint. | ||
* @see https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims | ||
* | ||
* @public | ||
*/ | ||
export declare interface UserProfile { | ||
/** Identifier for the End-User at the Issuer */ | ||
sub?: string; | ||
@@ -1286,2 +1292,44 @@ sid?: string; | ||
auth_time?: number; | ||
/** End-User's full name in displayable form including all name parts, possibly including titles and suffixes, ordered according to the End-User's locale and preferences */ | ||
name?: string; | ||
/** Given name(s) or first name(s) of the End-User. Note that in some cultures, people can have multiple given names; all can be present, with the names being separated by space characters. */ | ||
given_name?: string; | ||
/** Surname(s) or last name(s) of the End-User. Note that in some cultures, people can have multiple family names or no family name; all can be present, with the names being separated by space characters. */ | ||
family_name?: string; | ||
/** Middle name(s) of the End-User. Note that in some cultures, people can have multiple middle names; all can be present, with the names being separated by space characters. Also note that in some cultures, middle names are not used. */ | ||
middle_name?: string; | ||
/** Casual name of the End-User that may or may not be the same as the given_name. For instance, a nickname value of Mike might be returned alongside a given_name value of Michael. */ | ||
nickname?: string; | ||
/** Shorthand name by which the End-User wishes to be referred to at the RP, such as janedoe or j.doe */ | ||
preferred_username?: string; | ||
/** URL of the End-User's profile page. The contents of this Web page SHOULD be about the End-User. */ | ||
profile?: string; | ||
/** URL of the End-User's profile picture. This URL MUST refer to an image file (for example, a PNG, JPEG, or GIF image file), rather than to a Web page containing an image. Note that this URL SHOULD specifically reference a profile photo of the End-User suitable for displaying when describing the End-User, rather than an arbitrary photo taken by the End-User. */ | ||
picture?: string; | ||
/** URL of the End-User's Web page or blog. This Web page SHOULD contain information published by the End-User or an organization that the End-User is affiliated with. */ | ||
website?: string; | ||
/** End-User's preferred e-mail address. Its value MUST conform to the RFC 5322 addr-spec syntax. */ | ||
email?: string; | ||
/** True if the End-User's e-mail address has been verified; otherwise false. When this Claim Value is true, this means that the OP took affirmative steps to ensure that this e-mail address was controlled by the End-User at the time the verification was performed. The means by which an e-mail address is verified is context-specific, and dependent upon the trust framework or contractual agreements within which the parties are operating. */ | ||
email_verified?: boolean; | ||
/** End-User's gender. Values defined by this specification are female and male. Other values MAY be used when neither of the defined values are applicable. */ | ||
gender?: string; | ||
/** End-User's birthday, represented as an ISO 8601:2004 [ISO8601‑2004] YYYY-MM-DD format. The year MAY be 0000, indicating that it is omitted. To represent only the year, YYYY format is allowed. Note that depending on the underlying platform's date related function, providing just year can result in varying month and day, so the implementers need to take this factor into account to correctly process the dates. */ | ||
birthdate?: string; | ||
/** String from zoneinfo [zoneinfo] time zone database representing the End-User's time zone. For example, Europe/Paris or America/Los_Angeles. */ | ||
zoneinfo?: string; | ||
/** End-User's locale, represented as a BCP47 [RFC5646] language tag. This is typically an ISO 639-1 Alpha-2 [ISO639‑1] language code in lowercase and an ISO 3166-1 Alpha-2 [ISO3166‑1] country code in uppercase, separated by a dash. For example, en-US or fr-CA. As a compatibility note, some implementations have used an underscore as the separator rather than a dash, for example, en_US; */ | ||
locale?: string; | ||
/** End-User's preferred telephone number. E.164 [E.164] is RECOMMENDED as the format of this Claim, for example, +1 (425) 555-1212 or +56 (2) 687 2400. If the phone number contains an extension, it is RECOMMENDED that the extension be represented using the RFC 3966 [RFC3966] extension syntax, for example, +1 (604) 555-1234;ext=5678. */ | ||
phone_number?: string; | ||
/** True if the End-User's phone number has been verified; otherwise false. When this Claim Value is true, this means that the OP took affirmative steps to ensure that this phone number was controlled by the End-User at the time the verification was performed. The means by which a phone number is verified is context-specific, and dependent upon the trust framework or contractual agreements within which the parties are operating. When true, the phone_number Claim MUST be in E.164 format and any extensions MUST be represented in RFC 3966 format. */ | ||
phone_number_verified?: boolean; | ||
/** End-User's preferred postal address. The value of the address member is a JSON structure containing some or all of the members defined in the standard. | ||
* | ||
* @see https://openid.net/specs/openid-connect-core-1_0.html#AddressClaim | ||
*/ | ||
address?: Record<string, unknown>; | ||
/** Time the End-User's information was last updated. Its value is a JSON number representing the number of seconds from 1970-01-01T0:0:0Z as measured in UTC until the date/time. */ | ||
updated_at?: number; | ||
[claim: string]: unknown; | ||
} | ||
@@ -1288,0 +1336,0 @@ |
@@ -8,5 +8,5 @@ // This file is read by tools that parse documentation comments conforming to the TSDoc standard. | ||
"packageName": "@microsoft/api-extractor", | ||
"packageVersion": "7.18.19" | ||
"packageVersion": "7.19.2" | ||
} | ||
] | ||
} |
{ | ||
"name": "oidc-client-ts", | ||
"version": "2.0.0-rc.2", | ||
"version": "2.0.0-rc.3", | ||
"description": "OpenID Connect (OIDC) & OAuth2 client library", | ||
@@ -61,6 +61,7 @@ "repository": { | ||
"jest": "^27.2.0", | ||
"jest-mock": "^27.4.2", | ||
"lint-staged": "^12.0.2", | ||
"ts-jest": "^27.0.5", | ||
"typedoc": "^0.22.7", | ||
"typescript": "~4.4.3", | ||
"typescript": "~4.5.4", | ||
"yn": "^5.0.0" | ||
@@ -67,0 +68,0 @@ }, |
# oidc-client-ts | ||
[![Stable Release](https://img.shields.io/npm/v/oidc-client-ts.svg)](https://npm.im/oidc-client-ts) | ||
![Pipeline](https://github.com/authts/oidc-client-ts/workflows/Release/badge.svg) | ||
[![CI](https://github.com/authts/oidc-client-ts/actions/workflows/ci.yml/badge.svg)](https://github.com/authts/oidc-client-ts/actions/workflows/ci.yml) | ||
[![Codecov](https://img.shields.io/codecov/c/github/authts/oidc-client-ts)](https://app.codecov.io/gh/authts/oidc-client-ts) | ||
Library to provide OpenID Connect (OIDC) and OAuth2 protocol support for client-side, browser-based JavaScript client | ||
applications. Also included is support for user session and access token management. | ||
Library to provide OpenID Connect (OIDC) and OAuth2 protocol support for | ||
client-side, browser-based JavaScript client applications. Also included is | ||
support for user session and access token management. | ||
This is a forked version of the [oidc-client-js](https://github.com/IdentityModel/oidc-client-js) library, which has | ||
been archived and is no longer maintained. This version has been refactored from JavaScript to TypeScript. Trying to keep the API as compatible as possible. The support for the outdated implicit flow has been removed. When migrating see [here](docs/migration.md). | ||
This project is a fork of | ||
[IdentityModel/oidc-client-js](https://github.com/IdentityModel/oidc-client-js) | ||
which halted its development in June 2021. It has since been ported to | ||
TypeScript here with a similar API for the initial 2.0 release. Going forward, | ||
this library will focus only on protocols that continue to have support in | ||
[OAuth 2.1](https://oauth.net/2.1/). As such, the implicit grant is not | ||
supported by this client. Additional migration notes from `oidc-client` are | ||
available [here](docs/migration.md). | ||
**Contributions and help is much appreciated!** | ||
**Contributions and help are greatly appreciated!** | ||
Implements the following OAuth 2.0 protocols and supports [OpenID Connect](https://openid.net/specs/openid-connect-core-1_0.html): | ||
- [Authorization Code Grant](https://oauth.net/2/grant-types/authorization-code/) with [PKCE](https://oauth.net/2/pkce/) | ||
Implements the following OAuth 2.0 protocols and supports | ||
[OpenID Connect Core 1.0](https://openid.net/specs/openid-connect-core-1_0.html): | ||
- [Authorization Code Grant](https://oauth.net/2/grant-types/authorization-code/) | ||
with [PKCE](https://oauth.net/2/pkce/) | ||
- [Refresh Token Grant](https://oauth.net/2/grant-types/refresh-token/) | ||
## Table of Contents | ||
@@ -28,3 +37,2 @@ | ||
## Installation | ||
@@ -38,3 +46,2 @@ | ||
## Building the Source | ||
@@ -69,3 +76,2 @@ | ||
## Contributing | ||
@@ -75,5 +81,6 @@ | ||
## License | ||
This project is licensed under the Apache-2.0 license. See the [LICENSE](https://github.com/authts/oidc-client-ts/blob/main/LICENSE) file for more info. | ||
This project is licensed under the Apache-2.0 license. See the | ||
[LICENSE](https://github.com/authts/oidc-client-ts/blob/main/LICENSE) file for | ||
more info. |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1348621
9661
83
18