@atproto/oauth-types 0.7.3 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/util.d.ts +1 -1
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js.map +1 -1
- package/package.json +11 -7
- package/src/atproto-loopback-client-id.ts +0 -78
- package/src/atproto-loopback-client-metadata.ts +0 -47
- package/src/atproto-loopback-client-redirect-uris.ts +0 -4
- package/src/atproto-oauth-scope.ts +0 -34
- package/src/atproto-oauth-token-response.ts +0 -16
- package/src/constants.ts +0 -2
- package/src/index.ts +0 -50
- package/src/oauth-access-token.ts +0 -4
- package/src/oauth-authorization-code-grant-token-request.ts +0 -19
- package/src/oauth-authorization-details.ts +0 -48
- package/src/oauth-authorization-request-jar.ts +0 -16
- package/src/oauth-authorization-request-par.ts +0 -12
- package/src/oauth-authorization-request-parameters.ts +0 -100
- package/src/oauth-authorization-request-query.ts +0 -21
- package/src/oauth-authorization-request-uri.ts +0 -10
- package/src/oauth-authorization-response-error.ts +0 -25
- package/src/oauth-authorization-server-metadata.ts +0 -120
- package/src/oauth-client-credentials-grant-token-request.ts +0 -9
- package/src/oauth-client-credentials.ts +0 -53
- package/src/oauth-client-id-discoverable.ts +0 -130
- package/src/oauth-client-id-loopback.ts +0 -164
- package/src/oauth-client-id.ts +0 -4
- package/src/oauth-client-metadata.ts +0 -80
- package/src/oauth-code-challenge-method.ts +0 -3
- package/src/oauth-endpoint-auth-method.ts +0 -13
- package/src/oauth-endpoint-name.ts +0 -8
- package/src/oauth-grant-type.ts +0 -13
- package/src/oauth-introspection-response.ts +0 -23
- package/src/oauth-issuer-identifier.ts +0 -47
- package/src/oauth-par-response.ts +0 -8
- package/src/oauth-password-grant-token-request.ts +0 -11
- package/src/oauth-prompt-mode.ts +0 -18
- package/src/oauth-protected-resource-metadata.ts +0 -94
- package/src/oauth-redirect-uri.ts +0 -73
- package/src/oauth-refresh-token-grant-token-request.ts +0 -11
- package/src/oauth-refresh-token.ts +0 -4
- package/src/oauth-request-uri.ts +0 -5
- package/src/oauth-response-mode.ts +0 -9
- package/src/oauth-response-type.ts +0 -17
- package/src/oauth-scope.ts +0 -21
- package/src/oauth-token-identification.ts +0 -12
- package/src/oauth-token-request.ts +0 -14
- package/src/oauth-token-response.ts +0 -29
- package/src/oauth-token-type.ts +0 -15
- package/src/oidc-authorization-error-response.ts +0 -29
- package/src/oidc-claims-parameter.ts +0 -40
- package/src/oidc-claims-properties.ts +0 -11
- package/src/oidc-entity-type.ts +0 -5
- package/src/oidc-userinfo.ts +0 -15
- package/src/uri.ts +0 -221
- package/src/util.ts +0 -170
- package/tsconfig.build.json +0 -8
- package/tsconfig.build.tsbuildinfo +0 -1
- package/tsconfig.json +0 -4
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
|
|
3
|
-
export const oauthPasswordGrantTokenRequestSchema = z.object({
|
|
4
|
-
grant_type: z.literal('password'),
|
|
5
|
-
username: z.string(),
|
|
6
|
-
password: z.string(),
|
|
7
|
-
})
|
|
8
|
-
|
|
9
|
-
export type OAuthPasswordGrantTokenRequest = z.infer<
|
|
10
|
-
typeof oauthPasswordGrantTokenRequestSchema
|
|
11
|
-
>
|
package/src/oauth-prompt-mode.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* - "none" will only be allowed if the user already allowed the client on the same device
|
|
5
|
-
* - "login" will force the user to login again, unless he very recently logged in
|
|
6
|
-
* - "consent" will force the user to consent again
|
|
7
|
-
* - "select_account" will force the user to select an account
|
|
8
|
-
* - "create" will force the user registration screen
|
|
9
|
-
*/
|
|
10
|
-
export const oauthPromptModeSchema = z.enum([
|
|
11
|
-
'none',
|
|
12
|
-
'login',
|
|
13
|
-
'consent',
|
|
14
|
-
'select_account',
|
|
15
|
-
'create',
|
|
16
|
-
])
|
|
17
|
-
|
|
18
|
-
export type OAuthPromptMode = z.infer<typeof oauthPromptModeSchema>
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
import { oauthIssuerIdentifierSchema } from './oauth-issuer-identifier.js'
|
|
3
|
-
import { webUriSchema } from './uri.js'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @see {@link https://www.rfc-editor.org/rfc/rfc9728.html#section-3.2}
|
|
7
|
-
*/
|
|
8
|
-
export const oauthProtectedResourceMetadataSchema = z.object({
|
|
9
|
-
/**
|
|
10
|
-
* REQUIRED. The protected resource's resource identifier, which is a URL that
|
|
11
|
-
* uses the https scheme and has no query or fragment components. Using these
|
|
12
|
-
* well-known resources is described in Section 3.
|
|
13
|
-
*
|
|
14
|
-
* @note This schema allows non https URLs for testing & development purposes.
|
|
15
|
-
* Make sure to validate the URL before using it in a production environment.
|
|
16
|
-
*/
|
|
17
|
-
resource: webUriSchema
|
|
18
|
-
.refine((url) => !url.includes('?'), {
|
|
19
|
-
message: 'Resource URL must not contain query parameters',
|
|
20
|
-
})
|
|
21
|
-
.refine((url) => !url.includes('#'), {
|
|
22
|
-
message: 'Resource URL must not contain a fragment',
|
|
23
|
-
}),
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* OPTIONAL. JSON array containing a list of OAuth authorization server issuer
|
|
27
|
-
* identifiers, as defined in [RFC8414], for authorization servers that can be
|
|
28
|
-
* used with this protected resource. Protected resources MAY choose not to
|
|
29
|
-
* advertise some supported authorization servers even when this parameter is
|
|
30
|
-
* used. In some use cases, the set of authorization servers will not be
|
|
31
|
-
* enumerable, in which case this metadata parameter would not be used.
|
|
32
|
-
*/
|
|
33
|
-
authorization_servers: z.array(oauthIssuerIdentifierSchema).optional(),
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* OPTIONAL. URL of the protected resource's JWK Set [JWK] document. This
|
|
37
|
-
* contains public keys belonging to the protected resource, such as signing
|
|
38
|
-
* key(s) that the resource server uses to sign resource responses. This URL
|
|
39
|
-
* MUST use the https scheme. When both signing and encryption keys are made
|
|
40
|
-
* available, a use (public key use) parameter value is REQUIRED for all keys
|
|
41
|
-
* in the referenced JWK Set to indicate each key's intended usage.
|
|
42
|
-
*/
|
|
43
|
-
jwks_uri: webUriSchema.optional(),
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* RECOMMENDED. JSON array containing a list of the OAuth 2.0 [RFC6749] scope
|
|
47
|
-
* values that are used in authorization requests to request access to this
|
|
48
|
-
* protected resource. Protected resources MAY choose not to advertise some
|
|
49
|
-
* scope values supported even when this parameter is used.
|
|
50
|
-
*/
|
|
51
|
-
scopes_supported: z.array(z.string()).optional(),
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* OPTIONAL. JSON array containing a list of the supported methods of sending
|
|
55
|
-
* an OAuth 2.0 Bearer Token [RFC6750] to the protected resource. Defined
|
|
56
|
-
* values are ["header", "body", "query"], corresponding to Sections 2.1, 2.2,
|
|
57
|
-
* and 2.3 of RFC 6750.
|
|
58
|
-
*/
|
|
59
|
-
bearer_methods_supported: z
|
|
60
|
-
.array(z.enum(['header', 'body', 'query']))
|
|
61
|
-
.optional(),
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* OPTIONAL. JSON array containing a list of the JWS [JWS] signing algorithms
|
|
65
|
-
* (alg values) [JWA] supported by the protected resource for signing resource
|
|
66
|
-
* responses, for instance, as described in [FAPI.MessageSigning]. No default
|
|
67
|
-
* algorithms are implied if this entry is omitted. The value none MUST NOT be
|
|
68
|
-
* used.
|
|
69
|
-
*/
|
|
70
|
-
resource_signing_alg_values_supported: z.array(z.string()).optional(),
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* OPTIONAL. URL of a page containing human-readable information that
|
|
74
|
-
* developers might want or need to know when using the protected resource
|
|
75
|
-
*/
|
|
76
|
-
resource_documentation: webUriSchema.optional(),
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* OPTIONAL. URL that the protected resource provides to read about the
|
|
80
|
-
* protected resource's requirements on how the client can use the data
|
|
81
|
-
* provided by the protected resource
|
|
82
|
-
*/
|
|
83
|
-
resource_policy_uri: webUriSchema.optional(),
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* OPTIONAL. URL that the protected resource provides to read about the
|
|
87
|
-
* protected resource's terms of service
|
|
88
|
-
*/
|
|
89
|
-
resource_tos_uri: webUriSchema.optional(),
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
export type OAuthProtectedResourceMetadata = z.infer<
|
|
93
|
-
typeof oauthProtectedResourceMetadataSchema
|
|
94
|
-
>
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { TypeOf, ZodIssueCode, z } from 'zod'
|
|
2
|
-
import {
|
|
3
|
-
HttpsUri,
|
|
4
|
-
LoopbackUri,
|
|
5
|
-
PrivateUseUri,
|
|
6
|
-
httpsUriSchema,
|
|
7
|
-
loopbackUriSchema,
|
|
8
|
-
privateUseUriSchema,
|
|
9
|
-
} from './uri.js'
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* This is a {@link loopbackUriSchema} with the additional restriction that
|
|
13
|
-
* the hostname `localhost` is not allowed.
|
|
14
|
-
*
|
|
15
|
-
* @see {@link https://datatracker.ietf.org/doc/html/rfc8252#section-8.3 Loopback Redirect Considerations} RFC8252
|
|
16
|
-
*
|
|
17
|
-
* > While redirect URIs using localhost (i.e.,
|
|
18
|
-
* > "http://localhost:{port}/{path}") function similarly to loopback IP
|
|
19
|
-
* > redirects described in Section 7.3, the use of localhost is NOT
|
|
20
|
-
* > RECOMMENDED. Specifying a redirect URI with the loopback IP literal rather
|
|
21
|
-
* > than localhost avoids inadvertently listening on network interfaces other
|
|
22
|
-
* > than the loopback interface. It is also less susceptible to client-side
|
|
23
|
-
* > firewalls and misconfigured host name resolution on the user's device.
|
|
24
|
-
*/
|
|
25
|
-
export const loopbackRedirectURISchema = loopbackUriSchema.superRefine(
|
|
26
|
-
(value, ctx): value is Exclude<LoopbackUri, `http://localhost${string}`> => {
|
|
27
|
-
if (value.startsWith('http://localhost')) {
|
|
28
|
-
ctx.addIssue({
|
|
29
|
-
code: ZodIssueCode.custom,
|
|
30
|
-
message:
|
|
31
|
-
'Use of "localhost" hostname is not allowed (RFC 8252), use a loopback IP such as "127.0.0.1" instead',
|
|
32
|
-
})
|
|
33
|
-
return false
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return true
|
|
37
|
-
},
|
|
38
|
-
)
|
|
39
|
-
export type LoopbackRedirectURI = TypeOf<typeof loopbackRedirectURISchema>
|
|
40
|
-
|
|
41
|
-
export const oauthLoopbackClientRedirectUriSchema = loopbackRedirectURISchema
|
|
42
|
-
export type OAuthLoopbackRedirectURI = TypeOf<
|
|
43
|
-
typeof oauthLoopbackClientRedirectUriSchema
|
|
44
|
-
>
|
|
45
|
-
|
|
46
|
-
export const oauthRedirectUriSchema = z
|
|
47
|
-
.string()
|
|
48
|
-
.superRefine(
|
|
49
|
-
(value, ctx): value is HttpsUri | LoopbackRedirectURI | PrivateUseUri => {
|
|
50
|
-
if (value.startsWith('https:')) {
|
|
51
|
-
const result = httpsUriSchema.safeParse(value)
|
|
52
|
-
if (!result.success) result.error.issues.forEach(ctx.addIssue, ctx)
|
|
53
|
-
return result.success
|
|
54
|
-
} else if (value.startsWith('http:')) {
|
|
55
|
-
const result = loopbackRedirectURISchema.safeParse(value)
|
|
56
|
-
if (!result.success) result.error.issues.forEach(ctx.addIssue, ctx)
|
|
57
|
-
return result.success
|
|
58
|
-
} else if (/^[^.:]+(?:\.[^.:]+)+:/.test(value)) {
|
|
59
|
-
const result = privateUseUriSchema.safeParse(value)
|
|
60
|
-
if (!result.success) result.error.issues.forEach(ctx.addIssue, ctx)
|
|
61
|
-
return result.success
|
|
62
|
-
} else {
|
|
63
|
-
ctx.addIssue({
|
|
64
|
-
code: ZodIssueCode.custom,
|
|
65
|
-
message:
|
|
66
|
-
'URL must use the "https:" or "http:" protocol, or a private-use URI scheme (RFC 8252)',
|
|
67
|
-
})
|
|
68
|
-
return false
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
)
|
|
72
|
-
|
|
73
|
-
export type OAuthRedirectUri = TypeOf<typeof oauthRedirectUriSchema>
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
import { oauthRefreshTokenSchema } from './oauth-refresh-token.js'
|
|
3
|
-
|
|
4
|
-
export const oauthRefreshTokenGrantTokenRequestSchema = z.object({
|
|
5
|
-
grant_type: z.literal('refresh_token'),
|
|
6
|
-
refresh_token: oauthRefreshTokenSchema,
|
|
7
|
-
})
|
|
8
|
-
|
|
9
|
-
export type OAuthRefreshTokenGrantTokenRequest = z.infer<
|
|
10
|
-
typeof oauthRefreshTokenGrantTokenRequestSchema
|
|
11
|
-
>
|
package/src/oauth-request-uri.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
|
|
3
|
-
export const oauthResponseTypeSchema = z.enum([
|
|
4
|
-
// OAuth2 (https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-10#section-4.1.1)
|
|
5
|
-
'code', // Authorization Code Grant
|
|
6
|
-
'token', // Implicit Grant
|
|
7
|
-
|
|
8
|
-
// OIDC (https://openid.net/specs/oauth-v2-multiple-response-types-1_0.html)
|
|
9
|
-
'none',
|
|
10
|
-
'code id_token token',
|
|
11
|
-
'code id_token',
|
|
12
|
-
'code token',
|
|
13
|
-
'id_token token',
|
|
14
|
-
'id_token',
|
|
15
|
-
])
|
|
16
|
-
|
|
17
|
-
export type OAuthResponseType = z.infer<typeof oauthResponseTypeSchema>
|
package/src/oauth-scope.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
|
|
3
|
-
// scope = scope-token *( SP scope-token )
|
|
4
|
-
// scope-token = 1*( %x21 / %x23-5B / %x5D-7E )
|
|
5
|
-
export const OAUTH_SCOPE_REGEXP =
|
|
6
|
-
/^[\x21\x23-\x5B\x5D-\x7E]+(?: [\x21\x23-\x5B\x5D-\x7E]+)*$/
|
|
7
|
-
|
|
8
|
-
export const isOAuthScope = (input: string): boolean =>
|
|
9
|
-
OAUTH_SCOPE_REGEXP.test(input)
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* A (single) space separated list of non empty printable ASCII char string
|
|
13
|
-
* (except backslash and double quote).
|
|
14
|
-
*
|
|
15
|
-
* @see {@link https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-11#section-1.4.1}
|
|
16
|
-
*/
|
|
17
|
-
export const oauthScopeSchema = z.string().refine(isOAuthScope, {
|
|
18
|
-
message: 'Invalid OAuth scope',
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
export type OAuthScope = z.infer<typeof oauthScopeSchema>
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
import { oauthAccessTokenSchema } from './oauth-access-token.js'
|
|
3
|
-
import { oauthRefreshTokenSchema } from './oauth-refresh-token.js'
|
|
4
|
-
|
|
5
|
-
export const oauthTokenIdentificationSchema = z.object({
|
|
6
|
-
token: z.union([oauthAccessTokenSchema, oauthRefreshTokenSchema]),
|
|
7
|
-
token_type_hint: z.enum(['access_token', 'refresh_token']).optional(),
|
|
8
|
-
})
|
|
9
|
-
|
|
10
|
-
export type OAuthTokenIdentification = z.infer<
|
|
11
|
-
typeof oauthTokenIdentificationSchema
|
|
12
|
-
>
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
import { oauthAuthorizationCodeGrantTokenRequestSchema } from './oauth-authorization-code-grant-token-request.js'
|
|
3
|
-
import { oauthClientCredentialsGrantTokenRequestSchema } from './oauth-client-credentials-grant-token-request.js'
|
|
4
|
-
import { oauthPasswordGrantTokenRequestSchema } from './oauth-password-grant-token-request.js'
|
|
5
|
-
import { oauthRefreshTokenGrantTokenRequestSchema } from './oauth-refresh-token-grant-token-request.js'
|
|
6
|
-
|
|
7
|
-
export const oauthTokenRequestSchema = z.discriminatedUnion('grant_type', [
|
|
8
|
-
oauthAuthorizationCodeGrantTokenRequestSchema,
|
|
9
|
-
oauthRefreshTokenGrantTokenRequestSchema,
|
|
10
|
-
oauthPasswordGrantTokenRequestSchema,
|
|
11
|
-
oauthClientCredentialsGrantTokenRequestSchema,
|
|
12
|
-
])
|
|
13
|
-
|
|
14
|
-
export type OAuthTokenRequest = z.infer<typeof oauthTokenRequestSchema>
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
import { signedJwtSchema } from '@atproto/jwk'
|
|
3
|
-
import { oauthAuthorizationDetailsSchema } from './oauth-authorization-details.js'
|
|
4
|
-
import { oauthTokenTypeSchema } from './oauth-token-type.js'
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @see {@link https://www.rfc-editor.org/rfc/rfc6749.html#section-5.1 | RFC 6749 (OAuth2), Section 5.1}
|
|
8
|
-
*/
|
|
9
|
-
export const oauthTokenResponseSchema = z
|
|
10
|
-
.object({
|
|
11
|
-
// https://www.rfc-editor.org/rfc/rfc6749.html#section-5.1
|
|
12
|
-
access_token: z.string(),
|
|
13
|
-
token_type: oauthTokenTypeSchema,
|
|
14
|
-
scope: z.string().optional(),
|
|
15
|
-
refresh_token: z.string().optional(),
|
|
16
|
-
expires_in: z.number().optional(),
|
|
17
|
-
// https://openid.net/specs/openid-connect-core-1_0.html#TokenResponse
|
|
18
|
-
id_token: signedJwtSchema.optional(),
|
|
19
|
-
// https://datatracker.ietf.org/doc/html/rfc9396#name-enriched-authorization-deta
|
|
20
|
-
authorization_details: oauthAuthorizationDetailsSchema.optional(),
|
|
21
|
-
})
|
|
22
|
-
// https://www.rfc-editor.org/rfc/rfc6749.html#section-5.1
|
|
23
|
-
// > The client MUST ignore unrecognized value names in the response.
|
|
24
|
-
.passthrough()
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* @see {@link oauthTokenResponseSchema}
|
|
28
|
-
*/
|
|
29
|
-
export type OAuthTokenResponse = z.infer<typeof oauthTokenResponseSchema>
|
package/src/oauth-token-type.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
|
|
3
|
-
// Case insensitive input, normalized output
|
|
4
|
-
export const oauthTokenTypeSchema = z.union([
|
|
5
|
-
z
|
|
6
|
-
.string()
|
|
7
|
-
.regex(/^DPoP$/i)
|
|
8
|
-
.transform(() => 'DPoP' as const),
|
|
9
|
-
z
|
|
10
|
-
.string()
|
|
11
|
-
.regex(/^Bearer$/i)
|
|
12
|
-
.transform(() => 'Bearer' as const),
|
|
13
|
-
])
|
|
14
|
-
|
|
15
|
-
export type OAuthTokenType = z.infer<typeof oauthTokenTypeSchema>
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @see {@link https://openid.net/specs/openid-connect-core-1_0.html#AuthError}
|
|
5
|
-
*/
|
|
6
|
-
export const oidcAuthorizationResponseErrorSchema = z.enum([
|
|
7
|
-
// The Authorization Server requires End-User interaction of some form to proceed. This error MAY be returned when the prompt parameter value in the Authentication Request is none, but the Authentication Request cannot be completed without displaying a user interface for End-User interaction.
|
|
8
|
-
'interaction_required',
|
|
9
|
-
// The Authorization Server requires End-User authentication. This error MAY be returned when the prompt parameter value in the Authentication Request is none, but the Authentication Request cannot be completed without displaying a user interface for End-User authentication.
|
|
10
|
-
'login_required',
|
|
11
|
-
// The End-User is REQUIRED to select a session at the Authorization Server. The End-User MAY be authenticated at the Authorization Server with different associated accounts, but the End-User did not select a session. This error MAY be returned when the prompt parameter value in the Authentication Request is none, but the Authentication Request cannot be completed without displaying a user interface to prompt for a session to use.
|
|
12
|
-
'account_selection_required',
|
|
13
|
-
// The Authorization Server requires End-User consent. This error MAY be returned when the prompt parameter value in the Authentication Request is none, but the Authentication Request cannot be completed without displaying a user interface for End-User consent.
|
|
14
|
-
'consent_required',
|
|
15
|
-
// The request_uri in the Authorization Request returns an error or contains invalid data.
|
|
16
|
-
'invalid_request_uri',
|
|
17
|
-
// The request parameter contains an invalid Request Object.
|
|
18
|
-
'invalid_request_object',
|
|
19
|
-
// The OP does not support use of the request parameter defined in Section 6.
|
|
20
|
-
'request_not_supported',
|
|
21
|
-
// The OP does not support use of the request_uri parameter defined in Section 6.
|
|
22
|
-
'request_uri_not_supported',
|
|
23
|
-
// The OP does not support use of the registration parameter defined in Section 7.2.1.
|
|
24
|
-
'registration_not_supported',
|
|
25
|
-
])
|
|
26
|
-
|
|
27
|
-
export type OidcAuthorizationResponseError = z.infer<
|
|
28
|
-
typeof oidcAuthorizationResponseErrorSchema
|
|
29
|
-
>
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
|
|
3
|
-
export const oidcClaimsParameterSchema = z.enum([
|
|
4
|
-
// https://openid.net/specs/openid-provider-authentication-policy-extension-1_0.html#rfc.section.5.2
|
|
5
|
-
// if client metadata "require_auth_time" is true, this *must* be provided
|
|
6
|
-
'auth_time',
|
|
7
|
-
|
|
8
|
-
// OIDC
|
|
9
|
-
'nonce',
|
|
10
|
-
'acr',
|
|
11
|
-
|
|
12
|
-
// OpenID: "profile" scope
|
|
13
|
-
'name',
|
|
14
|
-
'family_name',
|
|
15
|
-
'given_name',
|
|
16
|
-
'middle_name',
|
|
17
|
-
'nickname',
|
|
18
|
-
'preferred_username',
|
|
19
|
-
'gender',
|
|
20
|
-
'picture',
|
|
21
|
-
'profile',
|
|
22
|
-
'website',
|
|
23
|
-
'birthdate',
|
|
24
|
-
'zoneinfo',
|
|
25
|
-
'locale',
|
|
26
|
-
'updated_at',
|
|
27
|
-
|
|
28
|
-
// OpenID: "email" scope
|
|
29
|
-
'email',
|
|
30
|
-
'email_verified',
|
|
31
|
-
|
|
32
|
-
// OpenID: "phone" scope
|
|
33
|
-
'phone_number',
|
|
34
|
-
'phone_number_verified',
|
|
35
|
-
|
|
36
|
-
// OpenID: "address" scope
|
|
37
|
-
'address',
|
|
38
|
-
])
|
|
39
|
-
|
|
40
|
-
export type OidcClaimsParameter = z.infer<typeof oidcClaimsParameterSchema>
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
|
|
3
|
-
const oidcClaimsValueSchema = z.union([z.string(), z.number(), z.boolean()])
|
|
4
|
-
|
|
5
|
-
export const oidcClaimsPropertiesSchema = z.object({
|
|
6
|
-
essential: z.boolean().optional(),
|
|
7
|
-
value: oidcClaimsValueSchema.optional(),
|
|
8
|
-
values: z.array(oidcClaimsValueSchema).optional(),
|
|
9
|
-
})
|
|
10
|
-
|
|
11
|
-
export type OidcClaimsProperties = z.infer<typeof oidcClaimsPropertiesSchema>
|
package/src/oidc-entity-type.ts
DELETED
package/src/oidc-userinfo.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
|
|
3
|
-
export const oidcUserinfoSchema = z.object({
|
|
4
|
-
sub: z.string(),
|
|
5
|
-
iss: z.string().url().optional(),
|
|
6
|
-
aud: z.union([z.string(), z.array(z.string()).min(1)]).optional(),
|
|
7
|
-
|
|
8
|
-
email: z.string().email().optional(),
|
|
9
|
-
email_verified: z.boolean().optional(),
|
|
10
|
-
name: z.string().optional(),
|
|
11
|
-
preferred_username: z.string().optional(),
|
|
12
|
-
picture: z.string().url().optional(),
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
export type OidcUserinfo = z.infer<typeof oidcUserinfoSchema>
|