diff --git a/src/OidcClientSettings.ts b/src/OidcClientSettings.ts index 89f1c447d..341ce099e 100644 --- a/src/OidcClientSettings.ts +++ b/src/OidcClientSettings.ts @@ -30,7 +30,7 @@ export interface OidcClientSettings { /** The scope being requested from the OIDC/OAuth2 provider (default: 'openid') */ scope?: string; /** The redirect URI of your client application to receive a response from the OIDC/OAuth2 provider */ - redirect_uri?: string; + redirect_uri: string; /** The OIDC/OAuth2 post-logout redirect URI */ post_logout_redirect_uri?: string; client_authentication?: string; @@ -74,7 +74,7 @@ export class OidcClientSettingsStore { public readonly client_secret: string | undefined; public readonly response_type: string; public readonly scope: string; - public readonly redirect_uri: string | undefined; + public readonly redirect_uri: string; public readonly post_logout_redirect_uri: string | undefined; public readonly client_authentication: string | undefined; diff --git a/test/unit/MetadataService.test.ts b/test/unit/MetadataService.test.ts index 4d398b032..96c11fc25 100644 --- a/test/unit/MetadataService.test.ts +++ b/test/unit/MetadataService.test.ts @@ -15,7 +15,8 @@ describe("MetadataService", () => { settings = { authority: "authority", - client_id: "client" + client_id: "client", + redirect_uri: "redirect" }; subject = new MetadataService(new OidcClientSettingsStore(settings)); }); @@ -36,6 +37,7 @@ describe("MetadataService", () => { settings = { authority: "authority", client_id: "client", + redirect_uri: "redirect", metadata: { issuer: "test" }, }; subject = new MetadataService(new OidcClientSettingsStore(settings)); @@ -65,6 +67,7 @@ describe("MetadataService", () => { settings = { authority: "authority", client_id: "client", + redirect_uri: "redirect", metadataUrl: "http://sts/metadata" }; subject = new MetadataService(new OidcClientSettingsStore(settings)); @@ -84,6 +87,7 @@ describe("MetadataService", () => { settings = { authority: "authority", client_id: "client", + redirect_uri: "redirect", metadataUrl: "http://sts/metadata" }; subject = new MetadataService(new OidcClientSettingsStore(settings)); @@ -103,6 +107,7 @@ describe("MetadataService", () => { settings = { authority: "authority", client_id: "client", + redirect_uri: "redirect", metadataUrl: "http://sts/metadata" }; subject = new MetadataService(new OidcClientSettingsStore(settings)); @@ -123,6 +128,7 @@ describe("MetadataService", () => { settings = { authority: "authority", client_id: "client", + redirect_uri: "redirect", metadataUrl: "http://sts/metadata", metadataSeed: { issuer: "one" } }; @@ -144,6 +150,7 @@ describe("MetadataService", () => { settings = { authority: "authority", client_id: "client", + redirect_uri: "redirect", metadataUrl: "http://sts/metadata" }; subject = new MetadataService(new OidcClientSettingsStore(settings)); @@ -176,6 +183,7 @@ describe("MetadataService", () => { settings = { authority: "authority", client_id: "client", + redirect_uri: "redirect", metadata: { issuer: "test" }, @@ -194,6 +202,7 @@ describe("MetadataService", () => { settings = { authority: "authority", client_id: "client", + redirect_uri: "redirect", metadata: { } }; @@ -213,6 +222,7 @@ describe("MetadataService", () => { settings = { authority: "authority", client_id: "client", + redirect_uri: "redirect", metadataUrl: "http://sts/metadata" }; subject = new MetadataService(new OidcClientSettingsStore(settings)); @@ -233,6 +243,7 @@ describe("MetadataService", () => { settings = { authority: "authority", client_id: "client", + redirect_uri: "redirect", metadata: { issuer: "http://sts" } @@ -255,6 +266,7 @@ describe("MetadataService", () => { settings = { authority: "authority", client_id: "client", + redirect_uri: "redirect", metadata: { authorization_endpoint: "http://sts/authorize" } @@ -277,6 +289,7 @@ describe("MetadataService", () => { settings = { authority: "authority", client_id: "client", + redirect_uri: "redirect", metadata: { userinfo_endpoint: "http://sts/userinfo" } @@ -299,6 +312,7 @@ describe("MetadataService", () => { settings = { authority: "authority", client_id: "client", + redirect_uri: "redirect", metadata: { end_session_endpoint: "http://sts/signout" } @@ -317,6 +331,7 @@ describe("MetadataService", () => { settings = { authority: "authority", client_id: "client", + redirect_uri: "redirect", metadata: { } }; @@ -338,6 +353,7 @@ describe("MetadataService", () => { settings = { authority: "authority", client_id: "client", + redirect_uri: "redirect", metadata: { check_session_iframe: "http://sts/check_session" } @@ -356,6 +372,7 @@ describe("MetadataService", () => { settings = { authority: "authority", client_id: "client", + redirect_uri: "redirect", metadata: { } }; @@ -387,6 +404,7 @@ describe("MetadataService", () => { settings = { authority: "authority", client_id: "client", + redirect_uri: "redirect", signingKeys: [{ kid: "test" }] }; subject = new MetadataService(new OidcClientSettingsStore(settings)); @@ -403,6 +421,7 @@ describe("MetadataService", () => { settings = { authority: "authority", client_id: "client", + redirect_uri: "redirect", metadata: { issuer: "test" } }; subject = new MetadataService(new OidcClientSettingsStore(settings)); @@ -421,6 +440,7 @@ describe("MetadataService", () => { settings = { authority: "authority", client_id: "client", + redirect_uri: "redirect", metadata: { jwks_uri: "http://sts/metadata/keys" } @@ -443,6 +463,7 @@ describe("MetadataService", () => { settings = { authority: "authority", client_id: "client", + redirect_uri: "redirect", metadata: { jwks_uri: "http://sts/metadata/keys" } @@ -470,6 +491,7 @@ describe("MetadataService", () => { settings = { authority: "authority", client_id: "client", + redirect_uri: "redirect", metadata: { jwks_uri: "http://sts/metadata/keys" } @@ -497,6 +519,7 @@ describe("MetadataService", () => { settings = { authority: "authority", client_id: "client", + redirect_uri: "redirect", metadata: { jwks_uri: "http://sts/metadata/keys" } diff --git a/test/unit/OidcClient.test.ts b/test/unit/OidcClient.test.ts index 7c10bbe45..ee6768aee 100644 --- a/test/unit/OidcClient.test.ts +++ b/test/unit/OidcClient.test.ts @@ -23,7 +23,7 @@ describe("OidcClient", () => { const settings: OidcClientSettings = { authority: "authority", client_id: "client", - redirect_uri: "http://app", + redirect_uri: "redirect", post_logout_redirect_uri: "http://app" }; subject = new OidcClient(settings); diff --git a/test/unit/OidcClientSettings.test.ts b/test/unit/OidcClientSettings.test.ts index 1b0de2210..d6d70c88b 100644 --- a/test/unit/OidcClientSettings.test.ts +++ b/test/unit/OidcClientSettings.test.ts @@ -17,7 +17,8 @@ describe("OidcClientSettings", () => { // act const subject = new OidcClientSettingsStore({ authority: "authority", - client_id: "client" + client_id: "client", + redirect_uri: "redirect" }); // assert @@ -31,6 +32,7 @@ describe("OidcClientSettings", () => { const subject = new OidcClientSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", client_secret: "secret" }); @@ -45,6 +47,7 @@ describe("OidcClientSettings", () => { const subject = new OidcClientSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", response_type: "foo" }); @@ -56,7 +59,8 @@ describe("OidcClientSettings", () => { // act const subject = new OidcClientSettingsStore({ authority: "authority", - client_id: "client" + client_id: "client", + redirect_uri: "redirect" }); // assert @@ -71,6 +75,7 @@ describe("OidcClientSettings", () => { const subject = new OidcClientSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", scope: "foo" }); @@ -82,7 +87,8 @@ describe("OidcClientSettings", () => { // act const subject = new OidcClientSettingsStore({ authority: "authority", - client_id: "client" + client_id: "client", + redirect_uri: "redirect" }); // assert @@ -97,11 +103,11 @@ describe("OidcClientSettings", () => { const subject = new OidcClientSettingsStore({ authority: "authority", client_id: "client", - redirect_uri: "foo" + redirect_uri: "http://app" }); // assert - expect(subject.redirect_uri).toEqual("foo"); + expect(subject.redirect_uri).toEqual("http://app"); }); }); @@ -112,6 +118,7 @@ describe("OidcClientSettings", () => { const subject = new OidcClientSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", post_logout_redirect_uri: "http://app/loggedout" }); @@ -126,6 +133,7 @@ describe("OidcClientSettings", () => { const subject = new OidcClientSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", prompt: "foo" }); @@ -140,6 +148,7 @@ describe("OidcClientSettings", () => { const subject = new OidcClientSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", display: "foo" }); @@ -154,6 +163,7 @@ describe("OidcClientSettings", () => { const subject = new OidcClientSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", max_age: 22 }); @@ -168,6 +178,7 @@ describe("OidcClientSettings", () => { const subject = new OidcClientSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", ui_locales: "foo" }); @@ -182,6 +193,7 @@ describe("OidcClientSettings", () => { const subject = new OidcClientSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", acr_values: "foo" }); @@ -196,6 +208,7 @@ describe("OidcClientSettings", () => { const subject = new OidcClientSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", resource: "foo" }); @@ -210,6 +223,7 @@ describe("OidcClientSettings", () => { const subject = new OidcClientSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", response_mode: "foo" }); @@ -223,6 +237,7 @@ describe("OidcClientSettings", () => { // act const subject = new OidcClientSettingsStore({ client_id: "client", + redirect_uri: "redirect", authority: "http://sts" }); @@ -237,6 +252,7 @@ describe("OidcClientSettings", () => { const subject = new OidcClientSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", metadataUrl: "http://sts/metadata" }); @@ -251,6 +267,7 @@ describe("OidcClientSettings", () => { const subject = new OidcClientSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", metadata: { issuer: "test" } }); @@ -265,6 +282,7 @@ describe("OidcClientSettings", () => { const subject = new OidcClientSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", signingKeys: [{ kid: "test" }] }); @@ -279,7 +297,8 @@ describe("OidcClientSettings", () => { // act const subject = new OidcClientSettingsStore({ authority: "authority", - client_id: "client" + client_id: "client", + redirect_uri: "redirect", }); // assert @@ -291,6 +310,7 @@ describe("OidcClientSettings", () => { let subject = new OidcClientSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", filterProtocolClaims: true }); @@ -301,6 +321,7 @@ describe("OidcClientSettings", () => { subject = new OidcClientSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", filterProtocolClaims: false }); @@ -315,7 +336,8 @@ describe("OidcClientSettings", () => { // act const subject = new OidcClientSettingsStore({ authority: "authority", - client_id: "client" + client_id: "client", + redirect_uri: "redirect" }); // assert @@ -327,6 +349,7 @@ describe("OidcClientSettings", () => { let subject = new OidcClientSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", loadUserInfo: true }); @@ -337,6 +360,7 @@ describe("OidcClientSettings", () => { subject = new OidcClientSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", loadUserInfo: false }); @@ -351,7 +375,8 @@ describe("OidcClientSettings", () => { // act const subject = new OidcClientSettingsStore({ authority: "authority", - client_id: "client" + client_id: "client", + redirect_uri: "redirect" }); // assert @@ -363,6 +388,7 @@ describe("OidcClientSettings", () => { const subject = new OidcClientSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", staleStateAge: 100 }); @@ -377,7 +403,8 @@ describe("OidcClientSettings", () => { // act const subject = new OidcClientSettingsStore({ authority: "authority", - client_id: "client" + client_id: "client", + redirect_uri: "redirect" }); // assert @@ -389,6 +416,7 @@ describe("OidcClientSettings", () => { const subject = new OidcClientSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", clockSkew: 10 }); @@ -407,6 +435,7 @@ describe("OidcClientSettings", () => { const subject = new OidcClientSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", stateStore: temp }); @@ -425,6 +454,7 @@ describe("OidcClientSettings", () => { const subject = new OidcClientSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", stateStore: temp }); @@ -439,7 +469,8 @@ describe("OidcClientSettings", () => { // act const subject = new OidcClientSettingsStore({ authority: "authority", - client_id: "client" + client_id: "client", + redirect_uri: "redirect" }); // assert @@ -451,6 +482,7 @@ describe("OidcClientSettings", () => { const subject = new OidcClientSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", extraQueryParams: { "hd": "domain.com" } @@ -467,7 +499,8 @@ describe("OidcClientSettings", () => { // act const subject = new OidcClientSettingsStore({ authority: "authority", - client_id: "client" + client_id: "client", + redirect_uri: "redirect" }); // assert @@ -479,6 +512,7 @@ describe("OidcClientSettings", () => { const subject = new OidcClientSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", extraTokenParams: { "resourceServer": "abc" } diff --git a/test/unit/UserInfoService.test.ts b/test/unit/UserInfoService.test.ts index fedc56b91..02db34bd2 100644 --- a/test/unit/UserInfoService.test.ts +++ b/test/unit/UserInfoService.test.ts @@ -14,7 +14,8 @@ describe("UserInfoService", () => { beforeEach(() => { const settings = new OidcClientSettingsStore({ authority: "authority", - client_id: "client" + client_id: "client", + redirect_uri: "redirect" }); metadataService = new MetadataService(settings); diff --git a/test/unit/UserManager.test.ts b/test/unit/UserManager.test.ts index 8efbcef82..86c5689ec 100644 --- a/test/unit/UserManager.test.ts +++ b/test/unit/UserManager.test.ts @@ -24,6 +24,7 @@ describe("UserManager", () => { settings = { authority: "http://sts/oidc", client_id: "client", + redirect_uri: "redirect", monitorSession : false, userStore: userStoreMock, }; diff --git a/test/unit/UserManagerEvents.test.ts b/test/unit/UserManagerEvents.test.ts index f674abe27..2c93f65ec 100644 --- a/test/unit/UserManagerEvents.test.ts +++ b/test/unit/UserManagerEvents.test.ts @@ -11,7 +11,8 @@ describe("UserManagerEvents", () => { beforeEach(() => { const settings = new UserManagerSettingsStore({ authority: "authority", - client_id: "client" + client_id: "client", + redirect_uri: "redirect" }); subject = new UserManagerEvents(settings); }); diff --git a/test/unit/UserManagerSettings.test.ts b/test/unit/UserManagerSettings.test.ts index 455872d9e..4768f357f 100644 --- a/test/unit/UserManagerSettings.test.ts +++ b/test/unit/UserManagerSettings.test.ts @@ -18,7 +18,8 @@ describe("UserManagerSettings", () => { // act const subject = new UserManagerSettingsStore({ authority: "authority", - client_id: "client" + client_id: "client", + redirect_uri: "redirect" }); // assert @@ -34,6 +35,7 @@ describe("UserManagerSettings", () => { const subject = new UserManagerSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", popup_redirect_uri: "test" }); @@ -50,6 +52,7 @@ describe("UserManagerSettings", () => { const subject = new UserManagerSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", popupWindowFeatures: "foo" }); @@ -66,6 +69,7 @@ describe("UserManagerSettings", () => { const subject = new UserManagerSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", popupWindowTarget: "foo" }); @@ -82,6 +86,7 @@ describe("UserManagerSettings", () => { const subject = new UserManagerSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", silent_redirect_uri: "test" }); @@ -98,6 +103,7 @@ describe("UserManagerSettings", () => { const subject = new UserManagerSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", silentRequestTimeout: 123 }); @@ -114,6 +120,7 @@ describe("UserManagerSettings", () => { const subject = new UserManagerSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", automaticSilentRenew: true }); @@ -125,7 +132,8 @@ describe("UserManagerSettings", () => { // act const subject = new UserManagerSettingsStore({ authority: "authority", - client_id: "client" + client_id: "client", + redirect_uri: "redirect" }); // assert @@ -141,6 +149,7 @@ describe("UserManagerSettings", () => { const subject = new UserManagerSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", validateSubOnSilentRenew: true }); @@ -152,7 +161,8 @@ describe("UserManagerSettings", () => { // act const subject = new UserManagerSettingsStore({ authority: "authority", - client_id: "client" + client_id: "client", + redirect_uri: "redirect" }); // assert @@ -167,6 +177,7 @@ describe("UserManagerSettings", () => { const subject = new UserManagerSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", includeIdTokenInSilentRenew: true, }); @@ -179,6 +190,7 @@ describe("UserManagerSettings", () => { const subject = new UserManagerSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", includeIdTokenInSilentRenew: false, }); @@ -190,7 +202,8 @@ describe("UserManagerSettings", () => { // act const subject = new UserManagerSettingsStore({ authority: "authority", - client_id: "client" + client_id: "client", + redirect_uri: "redirect" }); // assert @@ -205,6 +218,7 @@ describe("UserManagerSettings", () => { const subject = new UserManagerSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", accessTokenExpiringNotificationTime: 10 }); @@ -216,7 +230,8 @@ describe("UserManagerSettings", () => { // act const subject = new UserManagerSettingsStore({ authority: "authority", - client_id: "client" + client_id: "client", + redirect_uri: "redirect" }); // assert @@ -233,6 +248,7 @@ describe("UserManagerSettings", () => { const subject = new UserManagerSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", userStore : temp }); @@ -247,6 +263,7 @@ describe("UserManagerSettings", () => { const subject = new UserManagerSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", revokeAccessTokenOnSignout : true }); @@ -261,6 +278,7 @@ describe("UserManagerSettings", () => { const subject = new UserManagerSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", checkSessionInterval : 6000 }); @@ -271,7 +289,8 @@ describe("UserManagerSettings", () => { // act const subject = new UserManagerSettingsStore({ authority: "authority", - client_id: "client" + client_id: "client", + redirect_uri: "redirect" }); // assert @@ -287,6 +306,7 @@ describe("UserManagerSettings", () => { const subject = new UserManagerSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", query_status_response_type : temp }); @@ -299,6 +319,7 @@ describe("UserManagerSettings", () => { const subject = new UserManagerSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", response_type: "id_token token" }); @@ -310,6 +331,7 @@ describe("UserManagerSettings", () => { const subject = new UserManagerSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", response_type: "code" }); @@ -325,6 +347,7 @@ describe("UserManagerSettings", () => { const subject = new UserManagerSettingsStore({ authority: "authority", client_id: "client", + redirect_uri: "redirect", stopCheckSessionOnError : false }); @@ -335,7 +358,8 @@ describe("UserManagerSettings", () => { // act const subject = new UserManagerSettingsStore({ authority: "authority", - client_id: "client" + client_id: "client", + redirect_uri: "redirect" }); // assert