forked from bluesky-social/atproto
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add OAuth tests (bluesky-social#2874)
* Improve error message when using invalid client_id during code exchange * Extract SPA example OAuth client in own package * wip * remove dependency on get-port * Properly configure jest to only transpile "get-port" from node_modules https://jestjs.io/docs/configuration#transformignorepatterns-arraystring * Use dynamically assigned port number during tests * use puppeteer to run tests * remove login input "id" attribute * code style * add missing declaration * tidy * headless * remove get-port dependency * fix tests/proxied/admin.test.ts * fix tests * Allow unsecure oauth providers through configuration * transpile "lande" during ozone tests * Cache Puppeteer browser binaries * Use puppeteer cache during all workflow steps * remove use of set-output * use get-port in xrpc-server tests * Renamed to allowHttp * tidy * tidy
- Loading branch information
1 parent
60df3fc
commit 7f26b17
Showing
69 changed files
with
1,247 additions
and
419 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@atproto/oauth-client-browser": patch | ||
"@atproto/oauth-client": patch | ||
--- | ||
|
||
Add `allowHttp` OAuthClient construction option to allow working with "http:" oauth providers (for development & testing purposes). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@atproto/oauth-types": minor | ||
--- | ||
|
||
Allow oauthIssuerIdentifier to be an "http:" url. Make sure to manually check for "http:" issuers if you don't allow them. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@atproto-labs/did-resolver": patch | ||
--- | ||
|
||
Add "allowHttp" did:web method option |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@atproto/oauth-client-node": patch | ||
--- | ||
|
||
Bugfix: Prevent accidental override of `NodeOAuthClient` constructor options |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@atproto/oauth-types": minor | ||
--- | ||
|
||
Remove ALLOW_UNSECURE_ORIGINS constant |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@atproto/oauth-provider": patch | ||
--- | ||
|
||
Improve error message when invalid client id used during code exchange |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@atproto/oauth-types": patch | ||
--- | ||
|
||
Improve typing of oauthIssuerIdentifierSchema |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
import http from 'node:http' | ||
import { once } from 'node:events' | ||
import { createServer } from 'node:http' | ||
|
||
export async function createHeaderEchoServer(port: number) { | ||
return new Promise<http.Server>((resolve) => { | ||
const server = http.createServer() | ||
|
||
server | ||
.on('request', (request, response) => { | ||
response.setHeader('content-type', 'application/json') | ||
response.end( | ||
JSON.stringify({ | ||
...request.headers, | ||
did: 'did:web:fake.com', | ||
availableUserDomains: [], | ||
}), | ||
) | ||
}) | ||
.on('listening', () => resolve(server)) | ||
.listen(port) | ||
export async function createHeaderEchoServer(port: number = 0) { | ||
const server = createServer((req, res) => { | ||
res.writeHead(200, undefined, { 'content-type': 'application/json' }) | ||
res.end( | ||
JSON.stringify({ | ||
...req.headers, | ||
did: 'did:web:fake.com', | ||
availableUserDomains: [], | ||
}), | ||
) | ||
}) | ||
|
||
server.listen(port) | ||
|
||
await once(server, 'listening') | ||
|
||
return server | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
/** @type {import('jest').Config} */ | ||
module.exports = { | ||
displayName: 'Lexicon', | ||
transform: { '^.+\\.(t|j)s$': '@swc/jest' }, | ||
transformIgnorePatterns: [`<rootDir>/node_modules/(?!get-port)`], | ||
transform: { '^.+\\.ts$': '@swc/jest' }, | ||
setupFiles: ['<rootDir>/../../jest.setup.ts'], | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
{ | ||
"name": "@atproto/oauth-client-browser-example", | ||
"version": "0.0.0", | ||
"license": "MIT", | ||
"description": "Example single page application app using ATPROTO OAuth", | ||
"keywords": [ | ||
"example", | ||
"spa", | ||
"atproto", | ||
"oauth", | ||
"browser", | ||
"client" | ||
], | ||
"homepage": "https://atproto.com", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/bluesky-social/atproto", | ||
"directory": "packages/oauth/oauth-client-browser" | ||
}, | ||
"type": "commonjs", | ||
"exports": { | ||
".": { | ||
"default": "./dist/files.json" | ||
} | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"@atproto-labs/rollup-plugin-bundle-manifest": "workspace:*", | ||
"@atproto/api": "workspace:*", | ||
"@atproto/oauth-client": "workspace:*", | ||
"@atproto/oauth-client-browser": "workspace:*", | ||
"@atproto/oauth-types": "workspace:*", | ||
"@atproto/xrpc": "workspace:*", | ||
"@rollup/plugin-commonjs": "^25.0.7", | ||
"@rollup/plugin-json": "^6.1.0", | ||
"@rollup/plugin-html": "^1.0.4", | ||
"@rollup/plugin-node-resolve": "^15.2.3", | ||
"@rollup/plugin-replace": "^5.0.5", | ||
"@rollup/plugin-terser": "^0.4.4", | ||
"@rollup/plugin-typescript": "^11.1.6", | ||
"@types/react": "^18.2.50", | ||
"@types/react-dom": "^18.2.18", | ||
"autoprefixer": "^10.4.17", | ||
"postcss": "^8.4.33", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"rollup": "^4.13.0", | ||
"rollup-plugin-postcss": "^4.0.2", | ||
"rollup-plugin-serve": "^1.1.1", | ||
"tailwindcss": "^3.4.1", | ||
"typescript": "^5.6.3" | ||
}, | ||
"scripts": { | ||
"build": "rollup --config rollup.config.js", | ||
"dev": "rollup --config rollup.config.js --watch" | ||
} | ||
} |
Oops, something went wrong.