Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion frontend/src/lib/hooks/oidc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export type OIDCValues = {
client_id: string;
redirect_uri: string;
state: string;
nonce: string;
};

interface IuseOIDCParams {
Expand All @@ -13,7 +14,7 @@ interface IuseOIDCParams {
missingParams: string[];
}

const optionalParams: string[] = ["state"];
const optionalParams: string[] = ["state", "nonce"];

export function useOIDCParams(params: URLSearchParams): IuseOIDCParams {
let compiled: string = "";
Expand All @@ -26,6 +27,7 @@ export function useOIDCParams(params: URLSearchParams): IuseOIDCParams {
client_id: params.get("client_id") ?? "",
redirect_uri: params.get("redirect_uri") ?? "",
state: params.get("state") ?? "",
nonce: params.get("nonce") ?? "",
};

for (const key of Object.keys(values)) {
Expand Down
1 change: 1 addition & 0 deletions frontend/src/pages/authorize-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export const AuthorizePage = () => {
client_id: props.client_id,
redirect_uri: props.redirect_uri,
state: props.state,
nonce: props.nonce,
});
},
mutationKey: ["authorize", props.client_id],
Expand Down
2 changes: 2 additions & 0 deletions internal/assets/migrations/000006_oidc_nonce.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE "oidc_codes" DROP COLUMN "nonce";
ALTER TABLE "oidc_tokens" DROP COLUMN "nonce";
2 changes: 2 additions & 0 deletions internal/assets/migrations/000006_oidc_nonce.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE "oidc_codes" ADD COLUMN "nonce" TEXT DEFAULT "";
ALTER TABLE "oidc_tokens" ADD COLUMN "nonce" TEXT DEFAULT "";
2 changes: 1 addition & 1 deletion internal/controller/oidc_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ func (controller *OIDCController) Token(c *gin.Context) {
return
}

tokenRes, err := controller.oidc.GenerateAccessToken(c, client, entry.Sub, entry.Scope)
tokenRes, err := controller.oidc.GenerateAccessToken(c, client, entry)

if err != nil {
tlog.App.Error().Err(err).Msg("Failed to generate access token")
Expand Down
2 changes: 2 additions & 0 deletions internal/repository/models.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 34 additions & 16 deletions internal/repository/oidc_queries.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading