Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Commit

Permalink
feat: #9 redirect_uri was and is a required setting
Browse files Browse the repository at this point in the history
  • Loading branch information
pamapa committed Aug 24, 2021
1 parent 07da093 commit 368b25e
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 24 deletions.
4 changes: 2 additions & 2 deletions src/OidcClientSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
25 changes: 24 additions & 1 deletion test/unit/MetadataService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ describe("MetadataService", () => {

settings = {
authority: "authority",
client_id: "client"
client_id: "client",
redirect_uri: "redirect"
};
subject = new MetadataService(new OidcClientSettingsStore(settings));
});
Expand All @@ -36,6 +37,7 @@ describe("MetadataService", () => {
settings = {
authority: "authority",
client_id: "client",
redirect_uri: "redirect",
metadata: { issuer: "test" },
};
subject = new MetadataService(new OidcClientSettingsStore(settings));
Expand Down Expand Up @@ -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));
Expand All @@ -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));
Expand All @@ -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));
Expand All @@ -123,6 +128,7 @@ describe("MetadataService", () => {
settings = {
authority: "authority",
client_id: "client",
redirect_uri: "redirect",
metadataUrl: "http://sts/metadata",
metadataSeed: { issuer: "one" }
};
Expand All @@ -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));
Expand Down Expand Up @@ -176,6 +183,7 @@ describe("MetadataService", () => {
settings = {
authority: "authority",
client_id: "client",
redirect_uri: "redirect",
metadata: {
issuer: "test"
},
Expand All @@ -194,6 +202,7 @@ describe("MetadataService", () => {
settings = {
authority: "authority",
client_id: "client",
redirect_uri: "redirect",
metadata: {
}
};
Expand All @@ -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));
Expand All @@ -233,6 +243,7 @@ describe("MetadataService", () => {
settings = {
authority: "authority",
client_id: "client",
redirect_uri: "redirect",
metadata: {
issuer: "http://sts"
}
Expand All @@ -255,6 +266,7 @@ describe("MetadataService", () => {
settings = {
authority: "authority",
client_id: "client",
redirect_uri: "redirect",
metadata: {
authorization_endpoint: "http://sts/authorize"
}
Expand All @@ -277,6 +289,7 @@ describe("MetadataService", () => {
settings = {
authority: "authority",
client_id: "client",
redirect_uri: "redirect",
metadata: {
userinfo_endpoint: "http://sts/userinfo"
}
Expand All @@ -299,6 +312,7 @@ describe("MetadataService", () => {
settings = {
authority: "authority",
client_id: "client",
redirect_uri: "redirect",
metadata: {
end_session_endpoint: "http://sts/signout"
}
Expand All @@ -317,6 +331,7 @@ describe("MetadataService", () => {
settings = {
authority: "authority",
client_id: "client",
redirect_uri: "redirect",
metadata: {
}
};
Expand All @@ -338,6 +353,7 @@ describe("MetadataService", () => {
settings = {
authority: "authority",
client_id: "client",
redirect_uri: "redirect",
metadata: {
check_session_iframe: "http://sts/check_session"
}
Expand All @@ -356,6 +372,7 @@ describe("MetadataService", () => {
settings = {
authority: "authority",
client_id: "client",
redirect_uri: "redirect",
metadata: {
}
};
Expand Down Expand Up @@ -387,6 +404,7 @@ describe("MetadataService", () => {
settings = {
authority: "authority",
client_id: "client",
redirect_uri: "redirect",
signingKeys: [{ kid: "test" }]
};
subject = new MetadataService(new OidcClientSettingsStore(settings));
Expand All @@ -403,6 +421,7 @@ describe("MetadataService", () => {
settings = {
authority: "authority",
client_id: "client",
redirect_uri: "redirect",
metadata: { issuer: "test" }
};
subject = new MetadataService(new OidcClientSettingsStore(settings));
Expand All @@ -421,6 +440,7 @@ describe("MetadataService", () => {
settings = {
authority: "authority",
client_id: "client",
redirect_uri: "redirect",
metadata: {
jwks_uri: "http://sts/metadata/keys"
}
Expand All @@ -443,6 +463,7 @@ describe("MetadataService", () => {
settings = {
authority: "authority",
client_id: "client",
redirect_uri: "redirect",
metadata: {
jwks_uri: "http://sts/metadata/keys"
}
Expand Down Expand Up @@ -470,6 +491,7 @@ describe("MetadataService", () => {
settings = {
authority: "authority",
client_id: "client",
redirect_uri: "redirect",
metadata: {
jwks_uri: "http://sts/metadata/keys"
}
Expand Down Expand Up @@ -497,6 +519,7 @@ describe("MetadataService", () => {
settings = {
authority: "authority",
client_id: "client",
redirect_uri: "redirect",
metadata: {
jwks_uri: "http://sts/metadata/keys"
}
Expand Down
2 changes: 1 addition & 1 deletion test/unit/OidcClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading

0 comments on commit 368b25e

Please sign in to comment.