-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: auth/cookie fixes for OIDC login (#1274)
* fix: wip auth/cookie fixes * chore: add tests for server auth fixes * chore: add one more test for callbackURL
- Loading branch information
1 parent
d94448d
commit 5af0757
Showing
6 changed files
with
122 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
internal/config/testdata/authentication/session_domain_scheme_port.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
authentication: | ||
required: true | ||
session: | ||
domain: "http://localhost:8080" | ||
secure: false | ||
methods: | ||
token: | ||
enabled: true | ||
oidc: | ||
enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package oidc | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestCallbackURL(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
host string | ||
want string | ||
}{ | ||
{ | ||
name: "plain", | ||
host: "localhost", | ||
want: "localhost/auth/v1/method/oidc/foo/callback", | ||
}, | ||
{ | ||
name: "no trailing slash", | ||
host: "localhost:8080", | ||
want: "localhost:8080/auth/v1/method/oidc/foo/callback", | ||
}, | ||
{ | ||
name: "with trailing slash", | ||
host: "localhost:8080/", | ||
want: "localhost:8080/auth/v1/method/oidc/foo/callback", | ||
}, | ||
{ | ||
name: "with protocol", | ||
host: "http://localhost:8080", | ||
want: "http://localhost:8080/auth/v1/method/oidc/foo/callback", | ||
}, | ||
{ | ||
name: "with protocol and trailing slash", | ||
host: "http://localhost:8080/", | ||
want: "http://localhost:8080/auth/v1/method/oidc/foo/callback", | ||
}, | ||
} | ||
for _, tt := range tests { | ||
tt := tt | ||
t.Run(tt.name, func(t *testing.T) { | ||
got := callbackURL(tt.host, "foo") | ||
assert.Equal(t, tt.want, got) | ||
}) | ||
} | ||
} |