auth-utils.d.ts 1.0 KB

1234567891011121314151617181920212223
  1. /**
  2. * Utilities for handling OAuth resource URIs.
  3. */
  4. /**
  5. * Converts a server URL to a resource URL by removing the fragment.
  6. * RFC 8707 section 2 states that resource URIs "MUST NOT include a fragment component".
  7. * Keeps everything else unchanged (scheme, domain, port, path, query).
  8. */
  9. export declare function resourceUrlFromServerUrl(url: URL | string): URL;
  10. /**
  11. * Checks if a requested resource URL matches a configured resource URL.
  12. * A requested resource matches if it has the same scheme, domain, port,
  13. * and its path starts with the configured resource's path.
  14. *
  15. * @param requestedResource The resource URL being requested
  16. * @param configuredResource The resource URL that has been configured
  17. * @returns true if the requested resource matches the configured resource, false otherwise
  18. */
  19. export declare function checkResourceAllowed({ requestedResource, configuredResource }: {
  20. requestedResource: URL | string;
  21. configuredResource: URL | string;
  22. }): boolean;
  23. //# sourceMappingURL=auth-utils.d.ts.map