Documentation
¶
Index ¶
- func JWKThumbprint(jwk string) (string, error)
- func New(_ context.Context, next http.Handler, config *Config, _ string) (http.Handler, error)
- func NopCloser(r io.Reader, c io.Closer) io.ReadCloser
- type Client
- type Config
- type JWT
- type JwtHeader
- type JwtPlugin
- func (jwtPlugin *JwtPlugin) BackgroundRefresh()
- func (jwtPlugin *JwtPlugin) CheckOpa(request *http.Request, token *JWT, rw http.ResponseWriter) (int, error)
- func (jwtPlugin *JwtPlugin) CheckToken(request *http.Request, rw http.ResponseWriter) (int, error)
- func (jwtPlugin *JwtPlugin) ExtractToken(request *http.Request) (*JWT, error)
- func (jwtPlugin *JwtPlugin) FetchKeys()
- func (jwtPlugin *JwtPlugin) ParseKeys(certificates []string) error
- func (jwtPlugin *JwtPlugin) ServeHTTP(rw http.ResponseWriter, request *http.Request)
- func (jwtPlugin *JwtPlugin) VerifyToken(jwtToken *JWT) error
- type Key
- type Keys
- type LogEvent
- type Network
- type Payload
- type PayloadInput
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JWKThumbprint ¶
JWKThumbprint creates a JWK thumbprint out of pub as specified in https://tools.ietf.org/html/rfc7638.
Types ¶
type Config ¶
type Config struct { OpaUrl string OpaAllowField string OpaBody bool OpaDebugMode bool PayloadFields []string Required bool Keys []string Alg string OpaHeaders map[string]string JwtHeaders map[string]string OpaResponseHeaders map[string]string OpaHttpStatusField string JwtCookieKey string }
Config the plugin configuration.
type JwtPlugin ¶
type JwtPlugin struct {
// contains filtered or unexported fields
}
JwtPlugin contains the runtime config
func (*JwtPlugin) BackgroundRefresh ¶
func (jwtPlugin *JwtPlugin) BackgroundRefresh()
func (*JwtPlugin) CheckToken ¶
func (*JwtPlugin) ExtractToken ¶
func (*JwtPlugin) ServeHTTP ¶
func (jwtPlugin *JwtPlugin) ServeHTTP(rw http.ResponseWriter, request *http.Request)
func (*JwtPlugin) VerifyToken ¶
type Key ¶
type Key struct { Kid string `json:"kid"` Kty string `json:"kty"` Alg string `json:"alg"` Use string `json:"use"` X5c []string `json:"x5c"` X5t string `json:"x5t"` N string `json:"n"` E string `json:"e"` K string `json:"k,omitempty"` X string `json:"x,omitempty"` Y string `json:"y,omitempty"` D string `json:"d,omitempty"` P string `json:"p,omitempty"` Q string `json:"q,omitempty"` Dp string `json:"dp,omitempty"` Dq string `json:"dq,omitempty"` Qi string `json:"qi,omitempty"` Crv string `json:"crv,omitempty"` }
Key is a JSON web key returned by the JWKS request.
type Keys ¶
type Keys struct { // Keys is an array of JSON web keys. Keys []Key `json:"keys"` }
Keys represents a set of JSON web keys.
type LogEvent ¶
type LogEvent struct { Level string `json:"level"` Msg string `json:"msg"` Time time.Time `json:"time"` Network Network `json:"network"` URL string `json:"url"` Sub string `json:"sub"` }
LogEvent contains a single log entry
type PayloadInput ¶
type PayloadInput struct { Host string `json:"host"` Method string `json:"method"` Path []string `json:"path"` Parameters url.Values `json:"parameters"` Headers map[string][]string `json:"headers"` JWTHeader JwtHeader `json:"tokenHeader"` JWTPayload map[string]interface{} `json:"tokenPayload"` Body map[string]interface{} `json:"body,omitempty"` Form url.Values `json:"form,omitempty"` }
PayloadInput is the input payload
type Response ¶
type Response struct {
Result map[string]json.RawMessage `json:"result"`
}
Response from OPA
Click to show internal directories.
Click to hide internal directories.