mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-11 16:17:39 +02:00
kubernetes apiserver integration (#1063)
* sessions: support bearer tokens in authorization * wip * remove dead code * refactor signed jwt code * use function * update per comments * fix test
This commit is contained in:
parent
5f6a67e6eb
commit
a70254ab76
10 changed files with 140 additions and 57 deletions
23
internal/sessions/header/header_store_test.go
Normal file
23
internal/sessions/header/header_store_test.go
Normal file
|
@ -0,0 +1,23 @@
|
|||
package header
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestTokenFromHeader(t *testing.T) {
|
||||
t.Run("pomerium type", func(t *testing.T) {
|
||||
r, _ := http.NewRequest("GET", "http://localhost/some/url", nil)
|
||||
r.Header.Set("Authorization", "Pomerium JWT")
|
||||
v := TokenFromHeader(r, "Authorization", "Pomerium")
|
||||
assert.Equal(t, "JWT", v)
|
||||
})
|
||||
t.Run("bearer type", func(t *testing.T) {
|
||||
r, _ := http.NewRequest("GET", "http://localhost/some/url", nil)
|
||||
r.Header.Set("Authorization", "Bearer Pomerium-JWT")
|
||||
v := TokenFromHeader(r, "Authorization", "Pomerium")
|
||||
assert.Equal(t, "JWT", v)
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue