Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(providers): add Duende IdentityServer 6 (#4850)
* add duende identity server 6 provider * Update docs/versioned_docs/version-v3/providers/duende-identity-server6.md Co-authored-by: Balázs Orbán <info@balazsorban.com> * Update docs/versioned_docs/version-v3/providers/duende-identity-server6.md Co-authored-by: Balázs Orbán <info@balazsorban.com> * Update packages/next-auth/src/providers/duende-identity-server6.ts Co-authored-by: Balázs Orbán <info@balazsorban.com> * Update packages/next-auth/src/providers/duende-identity-server6.ts Co-authored-by: Balázs Orbán <info@balazsorban.com> * Update docs/versioned_docs/version-v3/providers/duende-identity-server6.md Co-authored-by: Balázs Orbán <info@balazsorban.com> * Update apps/dev/pages/api/auth/[...nextauth].ts Co-authored-by: Balázs Orbán <info@balazsorban.com> * Update docs/versioned_docs/version-v3/providers/duende-identity-server6.md Co-authored-by: Balázs Orbán <info@balazsorban.com> * Update docs/versioned_docs/version-v3/providers/duende-identity-server6.md Co-authored-by: Balázs Orbán <info@balazsorban.com> * Update packages/next-auth/src/providers/duende-identity-server6.ts Co-authored-by: Balázs Orbán <info@balazsorban.com> Co-authored-by: Joshua <joshua.grant@tempcover.com> Co-authored-by: Balázs Orbán <info@balazsorban.com>
- Loading branch information
1 parent
9457593
commit 3c210d9
Showing
4 changed files
with
91 additions
and
1 deletion.
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
53 changes: 53 additions & 0 deletions
53
docs/versioned_docs/version-v3/providers/duende-identity-server6.md
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,53 @@ | ||
--- | ||
id: duende-identityserver6 | ||
title: DuendeIdentityServer6 | ||
--- | ||
|
||
## Documentation | ||
|
||
https://docs.duendesoftware.com/identityserver/v6 | ||
|
||
## Options | ||
|
||
The **DuendeIdentityServer6 Provider** comes with a set of default options: | ||
|
||
- [DuendeIdentityServer6 Provider options](https://github.com/nextauthjs/next-auth/tree/main/packages/next-auth/src/providers/duende-identity-server6.ts) | ||
|
||
You can override any of the options to suit your own use case. | ||
|
||
## Example | ||
|
||
```js | ||
import DuendeIDS6Provider from "next-auth/providers/duende-identity-server6" | ||
|
||
... | ||
providers: [ | ||
DuendeIDS6Provider({ | ||
clientId: process.env.DUENDE_IDS6_ID, | ||
clientSecret: process.env.DUENDE_IDS6_SECRET, | ||
issuer: process.env.DUENDE_IDS6_ISSUER, | ||
}) | ||
] | ||
... | ||
``` | ||
|
||
## Demo IdentityServer | ||
|
||
The configuration below is for the demo server at https://demo.duendesoftware.com/ | ||
|
||
If you want to try it out, you can copy and paste the configuration below. | ||
|
||
You can sign in to the demo service with either <b>bob/bob</b> or <b>alice/alice</b>. | ||
|
||
```js | ||
import DuendeIDS6Provider from "next-auth/providers/duende-identity-server6" | ||
... | ||
providers: [ | ||
DuendeIDS6Provider({ | ||
clientId: "interactive.confidential", | ||
clientSecret: "secret", | ||
issuer: "https://demo.duendesoftware.com", | ||
}) | ||
] | ||
... | ||
``` |
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 |
---|---|---|
|
@@ -54,6 +54,6 @@ providers: [ | |
clientSecret: "secret", | ||
protection: "pkce" | ||
}) | ||
} | ||
] | ||
... | ||
``` |
31 changes: 31 additions & 0 deletions
31
packages/next-auth/src/providers/duende-identity-server6.ts
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,31 @@ | ||
import type { OAuthConfig, OAuthUserConfig } from "./oauth" | ||
|
||
export interface DuendeISUser extends Record<string, any> { | ||
email: string | ||
id: string | ||
name: string | ||
verified: boolean | ||
} | ||
|
||
export default function DuendeIdentityServer6<P extends DuendeISUser>( | ||
options: OAuthUserConfig<P> | ||
): OAuthConfig<P> { | ||
return { | ||
id: "duende-identityserver6", | ||
name: "DuendeIdentityServer6", | ||
type: "oauth", | ||
wellKnown: `${options.issuer}/.well-known/openid-configuration`, | ||
authorization: { params: { scope: "openid profile email" } }, | ||
checks: ["pkce", "state"], | ||
idToken: true, | ||
profile(profile) { | ||
return { | ||
id: profile.sub, | ||
name: profile.name, | ||
email: profile.email, | ||
image: null, | ||
} | ||
}, | ||
options, | ||
} | ||
} |
3c210d9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
next-auth – ./
next-auth-git-main-nextauthjs.vercel.app
next-auth.js.org
next-auth-nextauthjs.vercel.app
www.next-auth.js.org
next-auth-phi-two.vercel.app