mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-09 23:27:43 +02:00
authorize: use opa for policy engine (#474)
Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
This commit is contained in:
parent
111aa8f4d5
commit
2f13488598
45 changed files with 1022 additions and 872 deletions
|
@ -25,8 +25,8 @@ func TestNewContext(t *testing.T) {
|
|||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
ctxOut := NewContext(tt.ctx, tt.t, tt.err)
|
||||
stateOut, errOut := FromContext(ctxOut)
|
||||
ctxOut := NewContext(tt.ctx, tt.t, "", tt.err)
|
||||
stateOut, _, errOut := FromContext(ctxOut)
|
||||
if diff := cmp.Diff(tt.t.Email, stateOut.Email); diff != "" {
|
||||
t.Errorf("NewContext() = %s", diff)
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ func Test_contextKey_String(t *testing.T) {
|
|||
|
||||
func testAuthorizer(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
_, err := FromContext(r.Context())
|
||||
_, _, err := FromContext(r.Context())
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusUnauthorized)
|
||||
return
|
||||
|
@ -84,8 +84,8 @@ func (ms *store) ClearSession(http.ResponseWriter, *http.Request) {
|
|||
}
|
||||
|
||||
// LoadSession returns the session and a error
|
||||
func (ms store) LoadSession(*http.Request) (*State, error) {
|
||||
return ms.Session, ms.LoadError
|
||||
func (ms store) LoadSession(*http.Request) (*State, string, error) {
|
||||
return ms.Session, "", ms.LoadError
|
||||
}
|
||||
|
||||
// SaveSession returns a save error.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue