1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-23 17:02:25 +03:00

OIDC: document OidcError use (#3808)

* comments

* Update src/oidc/authorize.ts

Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>

* Update src/oidc/register.ts

Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>

---------

Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
This commit is contained in:
Kerry
2023-10-19 10:01:56 +13:00
committed by GitHub
parent 6468d79458
commit 4bcea2cead
4 changed files with 13 additions and 2 deletions

View File

@@ -198,7 +198,8 @@ const normalizeBearerTokenResponseTokenType = (response: SigninResponse): Bearer
* @param code - authorization code as returned by OP during authorization * @param code - authorization code as returned by OP during authorization
* @param storedAuthorizationParams - stored params from start of oidc login flow * @param storedAuthorizationParams - stored params from start of oidc login flow
* @returns valid bearer token response * @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 ( export const completeAuthorizationCodeGrant = async (
code: string, code: string,

View File

@@ -14,6 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License. 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 { export enum OidcError {
NotSupported = "OIDC authentication not supported", NotSupported = "OIDC authentication not supported",
Misconfigured = "OIDC is misconfigured", Misconfigured = "OIDC is misconfigured",

View File

@@ -14,4 +14,9 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
export * from "./authorize";
export * from "./discovery";
export * from "./error";
export * from "./register";
export * from "./tokenRefresher"; export * from "./tokenRefresher";
export * from "./validate";

View File

@@ -34,7 +34,8 @@ export type OidcRegistrationClientMetadata = {
* @param registrationEndpoint - URL as returned from issuer ./well-known/openid-configuration * @param registrationEndpoint - URL as returned from issuer ./well-known/openid-configuration
* @param clientMetadata - registration metadata * @param clientMetadata - registration metadata
* @returns resolves to the registered client id when registration is successful * @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 ( const doRegistration = async (
registrationEndpoint: string, registrationEndpoint: string,