zudoku 0.3.1-dev.20 → 0.3.1-dev.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zudoku",
3
- "version": "0.3.1-dev.20",
3
+ "version": "0.3.1-dev.21",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -1,22 +1,17 @@
1
- import {
2
- Auth0AuthenticationConfig,
3
- OpenIDAuthenticationConfig,
4
- } from "../../../config/config.js";
1
+ import { Auth0AuthenticationConfig } from "../../../config/config.js";
5
2
  import { AuthenticationProviderInitializer } from "../authentication.js";
6
3
  import { useAuthState } from "../state.js";
7
4
  import { OpenIDAuthenticationProvider } from "./openid.js";
8
5
 
9
6
  class Auth0AuthenticationProvider extends OpenIDAuthenticationProvider {
10
- constructor(config: OpenIDAuthenticationConfig) {
11
- super(config);
12
-
13
- // Prefill the authorization server since we know what Auth0's config is
14
- this.authorizationServer = {
15
- issuer: config.issuer,
16
- authorization_endpoint: `${config.issuer}/authorize`,
17
- token_endpoint: `${config.issuer}/oauth/token`,
18
- code_challenge_methods_supported: ["S256", "plain"],
19
- };
7
+ constructor(config: Auth0AuthenticationConfig) {
8
+ super({
9
+ ...config,
10
+ type: "openid",
11
+ issuer: `https://${config.domain}`,
12
+ clientId: config.clientId,
13
+ audience: config.audience,
14
+ });
20
15
  }
21
16
 
22
17
  onAuthorizationUrl = async (
@@ -28,16 +23,6 @@ class Auth0AuthenticationProvider extends OpenIDAuthenticationProvider {
28
23
  }
29
24
  };
30
25
 
31
- override async getAuthServer() {
32
- this.authorizationServer = {
33
- issuer: new URL(this.authorizationEndpoint!).origin,
34
- authorization_endpoint: this.authorizationEndpoint,
35
- token_endpoint: this.tokenEndpoint,
36
- code_challenge_methods_supported: [],
37
- };
38
- return this.authorizationServer;
39
- }
40
-
41
26
  signOut = async (): Promise<void> => {
42
27
  useAuthState.setState({
43
28
  isAuthenticated: false,
@@ -79,11 +64,6 @@ class Auth0AuthenticationProvider extends OpenIDAuthenticationProvider {
79
64
 
80
65
  const auth0Auth: AuthenticationProviderInitializer<
81
66
  Auth0AuthenticationConfig
82
- > = ({ domain, ...options }) =>
83
- new Auth0AuthenticationProvider({
84
- ...options,
85
- type: "openid",
86
- issuer: `https://${domain}`,
87
- });
67
+ > = (options) => new Auth0AuthenticationProvider(options);
88
68
 
89
69
  export default auth0Auth;
@@ -40,8 +40,6 @@ class OpenIdAuthPlugin extends AuthenticationPlugin {
40
40
  export class OpenIDAuthenticationProvider implements AuthenticationProvider {
41
41
  protected client: oauth.Client;
42
42
  protected issuer: string;
43
- protected authorizationEndpoint: string | undefined;
44
- protected tokenEndpoint: string | undefined;
45
43
 
46
44
  protected authorizationServer: oauth.AuthorizationServer | undefined;
47
45
 
@@ -59,8 +57,6 @@ export class OpenIDAuthenticationProvider implements AuthenticationProvider {
59
57
  constructor({
60
58
  issuer,
61
59
  audience,
62
- authorizationEndpoint,
63
- tokenEndpoint,
64
60
  clientId,
65
61
  redirectToAfterSignUp,
66
62
  redirectToAfterSignIn,
@@ -72,8 +68,6 @@ export class OpenIDAuthenticationProvider implements AuthenticationProvider {
72
68
  };
73
69
  this.audience = audience;
74
70
  this.issuer = issuer;
75
- this.authorizationEndpoint = authorizationEndpoint;
76
- this.tokenEndpoint = tokenEndpoint;
77
71
  this.redirectToAfterSignUp = redirectToAfterSignUp ?? "/";
78
72
  this.redirectToAfterSignIn = redirectToAfterSignIn ?? "/";
79
73
  this.redirectToAfterSignOut = redirectToAfterSignOut ?? "/";
@@ -81,21 +75,12 @@ export class OpenIDAuthenticationProvider implements AuthenticationProvider {
81
75
 
82
76
  protected async getAuthServer() {
83
77
  if (!this.authorizationServer) {
84
- if (this.tokenEndpoint && this.authorizationEndpoint) {
85
- this.authorizationServer = {
86
- issuer: new URL(this.authorizationEndpoint!).origin,
87
- authorization_endpoint: this.authorizationEndpoint,
88
- token_endpoint: this.tokenEndpoint,
89
- code_challenge_methods_supported: [],
90
- };
91
- } else {
92
- const issuerUrl = new URL(this.issuer);
93
- const response = await oauth.discoveryRequest(issuerUrl);
94
- this.authorizationServer = await oauth.processDiscoveryResponse(
95
- issuerUrl,
96
- response,
97
- );
98
- }
78
+ const issuerUrl = new URL(this.issuer);
79
+ const response = await oauth.discoveryRequest(issuerUrl);
80
+ this.authorizationServer = await oauth.processDiscoveryResponse(
81
+ issuerUrl,
82
+ response,
83
+ );
99
84
  }
100
85
  return this.authorizationServer;
101
86
  }