Skip to content

Commit

Permalink
feat(providers): add authentik provider (#3625)
Browse files Browse the repository at this point in the history
* Added authentik provider

* Removed idToken
  • Loading branch information
Pacerino committed Jan 19, 2022
1 parent 5998526 commit a4d831d
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions src/providers/authentik.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import type { OAuthConfig, OAuthUserConfig } from "."

export interface AuthentikProfile {
iss: string,
sub: string,
aud: string,
exp: number,
iat: number,
auth_time: number,
acr: string,
c_hash: string,
nonce: string,
at_hash: string,
email: string,
email_verified: boolean,
name: string,
given_name: string,
family_name: string,
preferred_username: string,
nickname: string,
groups: string[]
}

export default function Authentik<
P extends Record<string, any> = AuthentikProfile
>(options: OAuthUserConfig<P>): OAuthConfig<P> {
return {
id: "authentik",
name: "Authentik",
wellKnown: `${options.issuer}/.well-known/openid-configuration`,
type: "oauth",
authorization: { params: { scope: "openid email profile" } },
checks: ["pkce", "state"],
profile(profile) {
return {
id: profile.sub,
name: profile.name ?? profile.preferred_username,
email: profile.email,
image: profile.picture,
}
},
options,
}
}

0 comments on commit a4d831d

Please sign in to comment.