package identifier

import "github.com/open-policy-agent/opa/v1/server/identifier"

Package identifier provides handlers for associating identity information with incoming requests.

Index

Functions

func ClientCertificates

func ClientCertificates(r *http.Request) ([]*x509.Certificate, bool)

ClientCertificates returns the ClientCertificates of the caller associated with ctx.

func Identity

func Identity(r *http.Request) (string, bool)

Identity returns the identity of the caller associated with ctx.

func SetClientCertificates

func SetClientCertificates(r *http.Request, v []*x509.Certificate) *http.Request

SetClientCertificates returns a new http.Request with the ClientCertificates set to v.

func SetIdentity

func SetIdentity(r *http.Request, v string) *http.Request

SetIdentity returns a new http.Request with the identity set to v.

Types

type TLSBased

type TLSBased struct {
	// contains filtered or unexported fields
}

TLSBased extracts the CN of the client's TLS ceritificate

func NewTLSBased

func NewTLSBased(inner http.Handler) *TLSBased

NewTLSBased returns a new TLSBased object.

func (*TLSBased) ServeHTTP

func (h *TLSBased) ServeHTTP(w http.ResponseWriter, r *http.Request)

type TokenBased

type TokenBased struct {
	// contains filtered or unexported fields
}

TokenBased extracts Bearer tokens from the request.

func NewTokenBased

func NewTokenBased(inner http.Handler) *TokenBased

NewTokenBased returns a new TokenBased object.

func (*TokenBased) ServeHTTP

func (h *TokenBased) ServeHTTP(w http.ResponseWriter, r *http.Request)

Source Files

certs.go identifier.go tls.go token.go

Version
v1.4.2 (latest)
Published
May 2, 2025
Platform
linux/amd64
Imports
4 packages
Last checked
6 hours ago

Tools for package owners.