Fix json input
Everything has to go through a json round trip to work. HTTP Request has function members within it that means it cannot go through a JSON round trip, so nil that for now
This commit is contained in:
		
							parent
							
								
									56a98c3fa9
								
							
						
					
					
						commit
						5ee52143e8
					
				|  | @ -7,9 +7,9 @@ import ( | ||||||
| 	"github.com/open-policy-agent/opa/rego" | 	"github.com/open-policy-agent/opa/rego" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| type authInput struct { | type AuthInput struct { | ||||||
| 	request *http.Request | 	Request *http.Request | ||||||
| 	session *sessionsapi.SessionState | 	Session *sessionsapi.SessionState | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func authorize(req *http.Request, session *sessionsapi.SessionState) (bool, error) { | func authorize(req *http.Request, session *sessionsapi.SessionState) (bool, error) { | ||||||
|  | @ -21,7 +21,7 @@ package oauth2proxy | ||||||
| default allow = false | default allow = false | ||||||
| 
 | 
 | ||||||
| allow { | allow { | ||||||
|   endswith(input.session.email, "@bar.com") |   endswith(input.Session.Email, "@bar.com") | ||||||
| } | } | ||||||
|     `), |     `), | ||||||
| 	) | 	) | ||||||
|  | @ -31,9 +31,9 @@ allow { | ||||||
| 		return false, err | 		return false, err | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	input := rego.EvalInput(authInput{ | 	input := rego.EvalInput(AuthInput{ | ||||||
| 		request: req, | 		Request: nil, | ||||||
| 		session: session, | 		Session: session, | ||||||
| 	}) | 	}) | ||||||
| 
 | 
 | ||||||
| 	result, err := query.Eval(req.Context(), input) | 	result, err := query.Eval(req.Context(), input) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue