cleanup auth-utils and remove example files
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
7b5bfcee52
commit
1f4e42c09e
2 changed files with 29 additions and 389 deletions
|
|
@ -14,6 +14,7 @@ import {
|
|||
OAuthError
|
||||
} from "../errors.js";
|
||||
import { OAuthServerConfig } from "../types.js";
|
||||
import { resourceUrlFromServerUrl } from "../../../shared/auth-utils.js";
|
||||
|
||||
export type AuthorizationHandlerOptions = {
|
||||
provider: OAuthServerProvider;
|
||||
|
|
@ -137,7 +138,7 @@ export function authorizationHandler({ provider, rateLimit: rateLimitConfig, con
|
|||
}
|
||||
|
||||
// Remove fragment from server URL if present (though it shouldn't have one)
|
||||
const canonicalServerUrl = config.serverUrl!.split('#')[0];
|
||||
const canonicalServerUrl = resourceUrlFromServerUrl(config.serverUrl!);
|
||||
|
||||
if (resource !== canonicalServerUrl) {
|
||||
throw new InvalidTargetError(
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import {
|
|||
InvalidTargetError
|
||||
} from "../errors.js";
|
||||
import { OAuthServerConfig } from "../types.js";
|
||||
import { resourceUrlFromServerUrl } from "../../../shared/auth-utils.js";
|
||||
|
||||
export type TokenHandlerOptions = {
|
||||
provider: OAuthServerProvider;
|
||||
|
|
@ -110,7 +111,7 @@ export function tokenHandler({ provider, rateLimit: rateLimitConfig, config }: T
|
|||
throw new InvalidRequestError("Resource parameter is required when server URL validation is enabled");
|
||||
}
|
||||
|
||||
const canonicalServerUrl = config.serverUrl!.split('#')[0];
|
||||
const canonicalServerUrl = resourceUrlFromServerUrl(config.serverUrl!);
|
||||
|
||||
if (resource !== canonicalServerUrl) {
|
||||
throw new InvalidTargetError(
|
||||
|
|
@ -161,7 +162,7 @@ export function tokenHandler({ provider, rateLimit: rateLimitConfig, config }: T
|
|||
throw new InvalidRequestError("Resource parameter is required when server URL validation is enabled");
|
||||
}
|
||||
|
||||
const canonicalServerUrl = config.serverUrl!.split('#')[0];
|
||||
const canonicalServerUrl = resourceUrlFromServerUrl(config.serverUrl!);
|
||||
|
||||
if (resource !== canonicalServerUrl) {
|
||||
throw new InvalidTargetError(
|
||||
|
|
|
|||
Loading…
Reference in a new issue