Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OIDC: document OidcError use #3808

Merged
merged 4 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/oidc/authorize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ const normalizeBearerTokenResponseTokenType = (response: SigninResponse): Bearer
* @param code - authorization code as returned by OP during authorization
* @param storedAuthorizationParams - stored params from start of oidc login flow
* @returns valid bearer token response
* @throws when request fails, or returned token response is invalid
* @throws An `Error` with `message` set to an entry in {@link OidcError},
* when the request fails, or the returned token response is invalid.
*/
export const completeAuthorizationCodeGrant = async (
code: string,
Expand Down
4 changes: 4 additions & 0 deletions src/oidc/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

/**
* Errors expected to be encountered during OIDC discovery, client registration, and authentication.
* Not intended to be displayed directly to the user.
*/
export enum OidcError {
NotSupported = "OIDC authentication not supported",
Misconfigured = "OIDC is misconfigured",
Expand Down
5 changes: 5 additions & 0 deletions src/oidc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,9 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

export * from "./authorize";
export * from "./discovery";
export * from "./error";
export * from "./register";
export * from "./tokenRefresher";
export * from "./validate";
3 changes: 2 additions & 1 deletion src/oidc/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export type OidcRegistrationClientMetadata = {
* @param registrationEndpoint - URL as returned from issuer ./well-known/openid-configuration
* @param clientMetadata - registration metadata
* @returns resolves to the registered client id when registration is successful
* @throws when registration request fails, or response is invalid
* @throws An `Error` with `message` set to an entry in {@link OidcError},
* when the registration request fails, or the response is invalid.
*/
const doRegistration = async (
registrationEndpoint: string,
Expand Down