-
Notifications
You must be signed in to change notification settings - Fork 2
/
oauthprovider.ts
32 lines (29 loc) · 1.09 KB
/
oauthprovider.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { Provider } from 'next-auth/providers/index';
import { baseAuthURL, baseUrl } from './constants/urls';
export const providerID = 'custom-stacklok-provider-id';
const providerName = 'custom-stacklok-provider-name';
export const clientId = 'minder-cli'; //TODO(allan): investigate use of minder-web
export const clientSecret = '';
const authorizationURL = `${baseAuthURL}/realms/stacklok/protocol/openid-connect/auth`;
export const tokenURL = `${baseAuthURL}/realms/stacklok/protocol/openid-connect/token`;
const issuerURL = `${baseAuthURL}/realms/stacklok`;
const jwksURL = `${baseAuthURL}/realms/stacklok/protocol/openid-connect/certs`;
const StacklokProvider = <Provider>{
id: providerID,
name: providerName,
type: 'oauth',
authorization: {
url: authorizationURL,
params: { scope: 'openid' },
},
checks: ['pkce'],
idToken: true,
token: tokenURL,
options: { clientId, clientSecret },
issuer: issuerURL,
jwks_endpoint: jwksURL,
profile(profile) {
return {id: profile.sub, ...profile}
},
};
export default StacklokProvider;