auth-backend: prettier + changeset tweak

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2022-01-27 10:52:00 +01:00
parent 53acf95366
commit 26c7fca6be
3 changed files with 18 additions and 17 deletions
@@ -211,22 +211,23 @@ export class OidcAuthProvider implements OAuthHandlers {
}
}
export const oAuth2DefaultSignInResolver: SignInResolver<OidcAuthResult> =
async (info, ctx) => {
const { profile } = info;
export const oAuth2DefaultSignInResolver: SignInResolver<
OidcAuthResult
> = async (info, ctx) => {
const { profile } = info;
if (!profile.email) {
throw new Error('Profile contained no email');
}
const userId = profile.email.split('@')[0];
const token = await ctx.tokenIssuer.issueToken({
claims: {
sub: `user:default/${userId}`,
ent: [`user:default/${userId}`],
},
});
return { id: userId, token };
};
if (!profile.email) {
throw new Error('Profile contained no email');
}
const userId = profile.email.split('@')[0];
const token = await ctx.tokenIssuer.issueToken({
claims: {
sub: `user:default/${userId}`,
ent: [`user:default/${userId}`],
},
});
return { id: userId, token };
};
/**
* OIDC provider callback options. An auth handler and a sign in resolver