Skip to content

Commit

Permalink
fix: populate password verification attempt hook (#1436)
Browse files Browse the repository at this point in the history
## What kind of change does this PR introduce?

We currently don't populate the hook name for the password verification
hook.

---------

Co-authored-by: joel <[email protected]>
  • Loading branch information
J0 and joel authored Feb 18, 2024
1 parent 3e57b61 commit f974bdb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions internal/api/token_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -605,19 +605,19 @@ func (ts *TokenTestSuite) TestPasswordVerificationHook() {
uri: "pg-functions://postgres/auth/password_verification_hook",
hookFunctionSQL: `
create or replace function password_verification_hook(input jsonb)
returns json as $$
returns jsonb as $$
begin
return json_build_object('decision', 'continue');
return jsonb_build_object('decision', 'continue');
end; $$ language plpgsql;`,
expectedCode: http.StatusOK,
}, {
desc: "Reject- Enabled",
uri: "pg-functions://postgres/auth/password_verification_hook_reject",
hookFunctionSQL: `
create or replace function password_verification_hook_reject(input jsonb)
returns json as $$
returns jsonb as $$
begin
return json_build_object('decision', 'reject');
return jsonb_build_object('decision', 'reject', 'message', 'You shall not pass!');
end; $$ language plpgsql;`,
expectedCode: http.StatusForbidden,
},
Expand Down
4 changes: 2 additions & 2 deletions internal/conf/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,8 +517,8 @@ func LoadGlobal(filename string) (*GlobalConfiguration, error) {
return nil, err
}

if config.Hook.CustomAccessToken.Enabled {
if err := config.Hook.CustomAccessToken.PopulateExtensibilityPoint(); err != nil {
if config.Hook.PasswordVerificationAttempt.Enabled {
if err := config.Hook.PasswordVerificationAttempt.PopulateExtensibilityPoint(); err != nil {
return nil, err
}
}
Expand Down

0 comments on commit f974bdb

Please sign in to comment.