-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nicolas Burtey
committed
Apr 29, 2024
1 parent
5fa04d3
commit 149910b
Showing
20 changed files
with
312 additions
and
46 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
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
query userDetails { | ||
me { | ||
id | ||
phone | ||
mobileSessions { | ||
id | ||
expiresAt | ||
issuedAt | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { listSessions as listSessionsService } from "@/services/kratos" | ||
|
||
export const listMobileSessions = async (userId: UserId) => { | ||
const list = await listSessionsService(userId) | ||
console.dir(list) | ||
return list | ||
} | ||
|
||
export const listDeleguateSessions = async (userId: UserId) => { | ||
|
||
} |
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
14 changes: 14 additions & 0 deletions
14
core/api/src/graphql/public/types/object/mobile-session.ts
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,14 @@ | ||
import Timestamp from "@/graphql/shared/types/scalar/timestamp" | ||
|
||
import { GT } from "@/graphql/index" | ||
|
||
const MobileSession = GT.Object({ | ||
name: "MobileSession", | ||
fields: () => ({ | ||
id: { type: GT.NonNullID }, | ||
issuedAt: { type: GT.NonNull(Timestamp) }, | ||
expiresAt: { type: GT.NonNull(Timestamp) }, | ||
}), | ||
}) | ||
|
||
export default MobileSession |
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import axios, { AxiosResponse } from "axios" | ||
|
||
const hydraUrl = process.env.HYDRA_ADMIN_URL || "http://localhost:4445" | ||
|
||
export const consentList = async (userId: UserId): Promise<ConsentSession[]> => { | ||
let res: AxiosResponse<any, any> | ||
|
||
try { | ||
res = await axios.get( | ||
`${hydraUrl}/admin/oauth2/auth/sessions/consent?subject=${userId}`, | ||
) | ||
} catch (err) { | ||
// TODO | ||
console.error(err) | ||
return [] | ||
} | ||
|
||
let sessions: ConsentSession[] | ||
|
||
try { | ||
console.dir(res.data, { depth: null }) | ||
sessions = res.data.map((request) => ({ | ||
scope: request.grant_scope, | ||
handledAt: new Date(request.handled_at), | ||
remember: request.remember, | ||
app: request.consent_request.client.client_name, | ||
})) | ||
} catch (err) { | ||
// TODO | ||
console.error(err) | ||
return [] | ||
} | ||
|
||
return sessions | ||
} |
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
Oops, something went wrong.