-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added microsoft adapter * Added MicrosoftConfig interface
- Loading branch information
1 parent
39160f8
commit 422be1d
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Oauth2Adapter, Oauth2WrappedConfig } from "./oauth2.js" | ||
import { OidcAdapter, OidcWrappedConfig } from "./oidc.js" | ||
|
||
export interface MicrosoftConfig extends Oauth2WrappedConfig { | ||
tenant: string | ||
} | ||
|
||
export function MicrosoftAdapter(config: MicrosoftConfig) { | ||
return Oauth2Adapter({ | ||
...config, | ||
type: "microsoft", | ||
endpoint: { | ||
authorization: `https://login.microsoftonline.com/${config?.tenant}/oauth2/v2.0/authorize`, | ||
token: `https://login.microsoftonline.com/${config?.tenant}/oauth2/v2.0/token`, | ||
}, | ||
}) | ||
} | ||
|
||
export function MicrosoftOidcAdapter(config: OidcWrappedConfig) { | ||
return OidcAdapter({ | ||
...config, | ||
type: "microsoft", | ||
issuer: "https://graph.microsoft.com/oidc/userinfo", | ||
}) | ||
} |