auth-backend: add a default auth handler for the oauth2-proxy provider

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2022-05-02 17:09:55 +02:00
parent ba901234cf
commit 0caff59719
2 changed files with 20 additions and 14 deletions
-12
View File
@@ -98,18 +98,6 @@ export default async function createPlugin(
// as how to sign a user in without a matching user entity in the catalog.
// You can try it out using `<ProxiedSignInPage {...props} provider="myproxy" />`
myproxy: providers.oauth2Proxy.create({
async authHandler(result) {
const user = result.getHeader('x-forwarded-user');
if (!user) {
throw new Error('Profile must have a username');
}
return {
profile: {
email: result.getHeader('x-forwarded-email'),
displayName: user,
},
};
},
signIn: {
async resolver({ result }, ctx) {
const entityRef = stringifyEntityRef({