oauth4webapi
Advanced tools
Comparing version 2.0.2 to 2.0.3
@@ -1,7 +0,7 @@ | ||
type JsonObject = { | ||
declare type JsonObject = { | ||
[Key in string]?: JsonValue; | ||
}; | ||
type JsonArray = JsonValue[]; | ||
type JsonPrimitive = string | number | boolean | null; | ||
type JsonValue = JsonPrimitive | JsonObject | JsonArray; | ||
declare type JsonArray = JsonValue[]; | ||
declare type JsonPrimitive = string | number | boolean | null; | ||
declare type JsonValue = JsonPrimitive | JsonObject | JsonArray; | ||
/** | ||
@@ -44,3 +44,3 @@ * Interface to pass an asymmetric private key and, optionally, its associated JWK Key ID to be | ||
*/ | ||
export type ClientAuthenticationMethod = 'client_secret_basic' | 'client_secret_post' | 'private_key_jwt' | 'none'; | ||
export declare type ClientAuthenticationMethod = 'client_secret_basic' | 'client_secret_post' | 'private_key_jwt' | 'none'; | ||
/** | ||
@@ -88,3 +88,3 @@ * Supported JWS `alg` Algorithm identifiers. | ||
*/ | ||
export type JWSAlgorithm = 'PS256' | 'ES256' | 'RS256' | 'EdDSA'; | ||
export declare type JWSAlgorithm = 'PS256' | 'ES256' | 'RS256' | 'EdDSA'; | ||
/** | ||
@@ -1019,3 +1019,3 @@ * Authorization Server Metadata | ||
export declare function validateAuthResponse(as: AuthorizationServer, client: Client, parameters: URLSearchParams | URL, expectedState?: string | typeof expectNoState | typeof skipStateCheck): CallbackParameters | OAuth2Error; | ||
type ReturnTypes = TokenEndpointResponse | OAuth2TokenEndpointResponse | OpenIDTokenEndpointResponse | ClientCredentialsGrantResponse | DeviceAuthorizationResponse | IntrospectionResponse | OAuth2Error | PushedAuthorizationResponse | URLSearchParams | UserInfoResponse; | ||
declare type ReturnTypes = TokenEndpointResponse | OAuth2TokenEndpointResponse | OpenIDTokenEndpointResponse | ClientCredentialsGrantResponse | DeviceAuthorizationResponse | IntrospectionResponse | OAuth2Error | PushedAuthorizationResponse | URLSearchParams | UserInfoResponse; | ||
export interface DeviceAuthorizationRequestOptions extends HttpRequestOptions, AuthenticatedRequestOptions { | ||
@@ -1022,0 +1022,0 @@ } |
let USER_AGENT; | ||
if (typeof navigator === 'undefined' || !navigator.userAgent?.startsWith?.('Mozilla/5.0 ')) { | ||
const NAME = 'oauth4webapi'; | ||
const VERSION = 'v2.0.1'; | ||
const VERSION = 'v2.0.3'; | ||
USER_AGENT = `${NAME}/${VERSION}`; | ||
@@ -117,6 +117,2 @@ } | ||
const SUPPORTED_JWS_ALGS = ['PS256', 'ES256', 'RS256', 'EdDSA']; | ||
function preserveBodyStream(response) { | ||
assertReadableResponse(response); | ||
return response.clone(); | ||
} | ||
function processDpopNonce(response) { | ||
@@ -209,5 +205,6 @@ const url = new URL(response.url); | ||
} | ||
assertReadableResponse(response); | ||
let json; | ||
try { | ||
json = await preserveBodyStream(response).json(); | ||
json = await response.json(); | ||
} | ||
@@ -595,5 +592,6 @@ catch { | ||
} | ||
assertReadableResponse(response); | ||
let json; | ||
try { | ||
json = await preserveBodyStream(response).json(); | ||
json = await response.json(); | ||
} | ||
@@ -749,3 +747,4 @@ catch { | ||
if (getContentType(response) === 'application/jwt') { | ||
const { claims } = await validateJwt(await preserveBodyStream(response).text(), checkSigningAlgorithm.bind(undefined, client.userinfo_signed_response_alg, as.userinfo_signing_alg_values_supported), noSignatureCheck) | ||
assertReadableResponse(response); | ||
const { claims } = await validateJwt(await response.text(), checkSigningAlgorithm.bind(undefined, client.userinfo_signed_response_alg, as.userinfo_signing_alg_values_supported), noSignatureCheck) | ||
.then(validateOptionalAudience.bind(undefined, client.client_id)) | ||
@@ -759,4 +758,5 @@ .then(validateOptionalIssuer.bind(undefined, as.issuer)); | ||
} | ||
assertReadableResponse(response); | ||
try { | ||
json = await preserveBodyStream(response).json(); | ||
json = await response.json(); | ||
} | ||
@@ -840,5 +840,6 @@ catch { | ||
} | ||
assertReadableResponse(response); | ||
let json; | ||
try { | ||
json = await preserveBodyStream(response).json(); | ||
json = await response.json(); | ||
} | ||
@@ -1109,3 +1110,4 @@ catch { | ||
if (getContentType(response) === 'application/token-introspection+jwt') { | ||
const { claims } = await validateJwt(await preserveBodyStream(response).text(), checkSigningAlgorithm.bind(undefined, client.introspection_signed_response_alg, as.introspection_signing_alg_values_supported), noSignatureCheck) | ||
assertReadableResponse(response); | ||
const { claims } = await validateJwt(await response.text(), checkSigningAlgorithm.bind(undefined, client.introspection_signed_response_alg, as.introspection_signing_alg_values_supported), noSignatureCheck) | ||
.then(checkJwtType.bind(undefined, 'token-introspection+jwt')) | ||
@@ -1121,4 +1123,5 @@ .then(validatePresence.bind(undefined, ['aud', 'iat', 'iss'])) | ||
else { | ||
assertReadableResponse(response); | ||
try { | ||
json = await preserveBodyStream(response).json(); | ||
json = await response.json(); | ||
} | ||
@@ -1160,5 +1163,6 @@ catch { | ||
} | ||
assertReadableResponse(response); | ||
let json; | ||
try { | ||
json = await preserveBodyStream(response).json(); | ||
json = await response.json(); | ||
} | ||
@@ -1181,4 +1185,5 @@ catch { | ||
if (response.status > 399 && response.status < 500) { | ||
assertReadableResponse(response); | ||
try { | ||
const json = await preserveBodyStream(response).json(); | ||
const json = await response.json(); | ||
if (isJsonObject(json) && typeof json.error === 'string' && json.error.length) { | ||
@@ -1471,5 +1476,6 @@ if (json.error_description !== undefined && typeof json.error_description !== 'string') { | ||
} | ||
assertReadableResponse(response); | ||
let json; | ||
try { | ||
json = await preserveBodyStream(response).json(); | ||
json = await response.json(); | ||
} | ||
@@ -1476,0 +1482,0 @@ catch { |
{ | ||
"name": "oauth4webapi", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "OAuth 2 / OpenID Connect for Web Platform API JavaScript runtimes", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -42,3 +42,3 @@ # OAuth 2 / OpenID Connect for Web Platform API JavaScript runtimes | ||
```js | ||
import * as oauth2 from 'https://deno.land/x/oauth4webapi@v2.0.2/mod.ts' | ||
import * as oauth2 from 'https://deno.land/x/oauth4webapi@v2.0.3/mod.ts' | ||
``` | ||
@@ -45,0 +45,0 @@ |
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
118812
2635
0