File tree Expand file tree Collapse file tree 2 files changed +48
-21
lines changed Expand file tree Collapse file tree 2 files changed +48
-21
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ import { OAuthConfig , OAuthUserConfig } from "."
2
+
3
+ export interface KeycloakProfile {
4
+ exp : number
5
+ iat : number
6
+ auth_time : number
7
+ jti : string
8
+ iss : string
9
+ aud : string
10
+ sub : string
11
+ typ : string
12
+ azp : string
13
+ session_state : string
14
+ at_hash : string
15
+ acr : string
16
+ sid : string
17
+ email_verified : boolean
18
+ name : string
19
+ preferred_username : string
20
+ given_name : string
21
+ family_name : string
22
+ email : string
23
+ picture : string
24
+ user : any
25
+ }
26
+
27
+ export default function Keycloak <
28
+ P extends Record < string , any > = KeycloakProfile
29
+ > ( options : OAuthUserConfig < P > ) : OAuthConfig < P > {
30
+ return {
31
+ id : "keycloak" ,
32
+ name : "Keycloak" ,
33
+ wellKnown : `${ options . issuer } /.well-known/openid-configuration` ,
34
+ type : "oauth" ,
35
+ authorization : { params : { scope : "openid email profile" } } ,
36
+ checks : [ "pkce" , "state" ] ,
37
+ idToken : true ,
38
+ profile ( profile ) {
39
+ return {
40
+ id : profile . sub ,
41
+ name : profile . name ?? profile . preferred_username ,
42
+ email : profile . email ,
43
+ image : profile . picture ,
44
+ }
45
+ } ,
46
+ options,
47
+ }
48
+ }
You can’t perform that action at this time.
0 commit comments