mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-31 18:07:17 +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
|
@ -42,16 +42,16 @@ func NewStore(enc encoding.Unmarshaler, headerType string) *Store {
|
|||
}
|
||||
|
||||
// LoadSession tries to retrieve the token string from the Authorization header.
|
||||
func (as *Store) LoadSession(r *http.Request) (*sessions.State, error) {
|
||||
cipherText := TokenFromHeader(r, as.authHeader, as.authType)
|
||||
if cipherText == "" {
|
||||
return nil, sessions.ErrNoSessionFound
|
||||
func (as *Store) LoadSession(r *http.Request) (*sessions.State, string, error) {
|
||||
jwt := TokenFromHeader(r, as.authHeader, as.authType)
|
||||
if jwt == "" {
|
||||
return nil, "", sessions.ErrNoSessionFound
|
||||
}
|
||||
var session sessions.State
|
||||
if err := as.encoder.Unmarshal([]byte(cipherText), &session); err != nil {
|
||||
return nil, sessions.ErrMalformed
|
||||
if err := as.encoder.Unmarshal([]byte(jwt), &session); err != nil {
|
||||
return nil, "", sessions.ErrMalformed
|
||||
}
|
||||
return &session, nil
|
||||
return &session, jwt, nil
|
||||
}
|
||||
|
||||
// TokenFromHeader retrieves the value of the authorization header from a given
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue