-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: device account version 3 #2741
Conversation
if (res instanceof Error) throw res | ||
|
||
const decoded = decode(res, { complete: true }) | ||
expect(decoded?.payload?.sub).toBe("anon") | ||
}) | ||
|
||
it("error if an invalid token is provided", async () => { | ||
const res = await sendOathkeeperRequest("invalid.token" as SessionToken) | ||
const res = await sendOathkeeperRequest("invalid.token" as SessionToken, "graphql") |
Check failure
Code scanning / CodeQL
Hard-coded credentials
if (res instanceof Error) throw res | ||
|
||
const decoded = decode(res, { complete: true }) | ||
expect(decoded?.payload?.sub).toBe("anon") | ||
}) | ||
|
||
it("error if an invalid token is provided", async () => { | ||
const res = await sendOathkeeperRequest("invalid.token" as SessionToken) | ||
const res = await sendOathkeeperRequest("invalid.token" as SessionToken, "graphql") |
Check failure
Code scanning / CodeQL
Hard-coded credentials
it("return sub if jwt is provided", async () => { | ||
// TODO jwt from helper | ||
const token = | ||
"eyJhbGciOiJSUzI1NiIsImtpZCI6IjFiOTdiMjIxLWNhMDgtNGViMi05ZDA5LWE1NzcwZmNjZWIzNyJ9.eyJzdWIiOiIxOjcyMjc5Mjk3MzY2OmFuZHJvaWQ6VEVTVEUyRUFDQ09VTlQ1YWE3NWFmNyIsImF1ZCI6WyJwcm9qZWN0cy83MjI3OTI5NzM2NiIsInByb2plY3RzL2dhbG95YXBwIl0sInByb3ZpZGVyIjoiZGVidWciLCJpc3MiOiJodHRwczovL2ZpcmViYXNlYXBwY2hlY2suZ29vZ2xlYXBpcy5jb20vNzIyNzkyOTczNjYiLCJleHAiOjI2MzkwMDAwNjl9.Fh11HcuTal_S_26xFwIUWYivY0NzKGYrpBwNgQ-1QnfLZwUaHlMCX4hj4tcRJiKMX2UU_pnZCWgVnBqM9rbeSLFj35OvyP0z4rnflLOOl-UBrQQs4pVSUCpmh8eLX5lkh27KhdGOifND3jJPkKhPeVI9-hpZKNTYdU9y3M1yFF4BjvHs05nf8Zu3tWfpj0_LNPE-H0eXiiHaEUDv_GPA4HgLSAyxdh8bFoVC36UjpG-vm8Tt7jOUDnGc3s7jQk_lIJ3uCs8JXU4LfhSAQS6Q9UYmpFFUgsrUaZ6T_o2XTZtHgd_9qOUVvTChL-0dDGyDvB1tzofwIzLwxj7TGoEDGQ" as SessionToken |
Check failure
Code scanning / CodeQL
Hard-coded credentials
it("return sub if jwt is provided", async () => { | ||
// TODO jwt from helper | ||
const token = | ||
"eyJhbGciOiJSUzI1NiIsImtpZCI6IjFiOTdiMjIxLWNhMDgtNGViMi05ZDA5LWE1NzcwZmNjZWIzNyJ9.eyJzdWIiOiIxOjcyMjc5Mjk3MzY2OmFuZHJvaWQ6VEVTVEUyRUFDQ09VTlQ1YWE3NWFmNyIsImF1ZCI6WyJwcm9qZWN0cy83MjI3OTI5NzM2NiIsInByb2plY3RzL2dhbG95YXBwIl0sInByb3ZpZGVyIjoiZGVidWciLCJpc3MiOiJodHRwczovL2ZpcmViYXNlYXBwY2hlY2suZ29vZ2xlYXBpcy5jb20vNzIyNzkyOTczNjYiLCJleHAiOjI2MzkwMDAwNjl9.Fh11HcuTal_S_26xFwIUWYivY0NzKGYrpBwNgQ-1QnfLZwUaHlMCX4hj4tcRJiKMX2UU_pnZCWgVnBqM9rbeSLFj35OvyP0z4rnflLOOl-UBrQQs4pVSUCpmh8eLX5lkh27KhdGOifND3jJPkKhPeVI9-hpZKNTYdU9y3M1yFF4BjvHs05nf8Zu3tWfpj0_LNPE-H0eXiiHaEUDv_GPA4HgLSAyxdh8bFoVC36UjpG-vm8Tt7jOUDnGc3s7jQk_lIJ3uCs8JXU4LfhSAQS6Q9UYmpFFUgsrUaZ6T_o2XTZtHgd_9qOUVvTChL-0dDGyDvB1tzofwIzLwxj7TGoEDGQ" as SessionToken |
Check failure
Code scanning / CodeQL
Hard-coded credentials
authRouter.post("/create/device-account", async (req, res) => { | ||
try { | ||
//const { deviceId, uuidV4Username, uuidV4Password } = req.body | ||
const user = basicAuth(req) | ||
if (user?.name && user?.pass) { | ||
const username = user.name | ||
const password = user.pass | ||
console.log("username", username) | ||
console.log("password", password) | ||
// TODO call create device account | ||
return res.status(200).send({ | ||
result: "NOT IMPLEMENTED", | ||
}) | ||
} else { | ||
return res.status(401).send({ result: "Unauthorized" }) | ||
} | ||
} catch (e) { | ||
return res.status(500).send({ result: "" }) | ||
} | ||
}) |
Check failure
Code scanning / CodeQL
Missing rate limiting
A couple questions:
|
superseeded by #2747 |
Device Account v3
3 flows
(1) New User/Password Flow
(2) Login User/Password Flow
RETURN kratos session token
oathkeeper might be able to validate basic auth in a future PR here ory/oathkeeper#1044
(3) Upgrade To Phone Flow
RETURN success=true|error and optional kratos session token (if phone account already exists)