Documentation ¶
Index ¶
- Constants
- Variables
- func Handler(username, password string) http.Handler
- func Middleware(handler http.Handler) http.Handler
- type Context
- func (c *Context) ClientError()
- func (c *Context) Close() error
- func (c *Context) Continue()
- func (c *Context) Observe(v float64)
- func (c *Context) ServerError()
- func (c *Context) Set(key, value string)
- func (c *Context) SetError(err error, reason, description string)
- func (c *Context) Success()
- func (c *Context) UserError()
- type EndpointMetrics
- type ErrorReporter
- type LogContext
- type ResponseCollcetor
Constants ¶
View Source
const (
NAMESPACE = "lauth"
)
Variables ¶
View Source
var ( Authz = NewEndpointMetrics( "authz", []string{"method", "response_type", "client_id", "username", "scope", "prompt", "authn_by"}, []string{"method", "response_type", "authn_by"}, ) )
View Source
var ( HTTPLatency = prometheus.NewSummaryVec( prometheus.SummaryOpts{ Namespace: NAMESPACE, Subsystem: "http", Name: "latency_seconds", Help: "The whole latency of each endpoint. It is includes non-core process like minifying or compression.", }, []string{"method", "path", "status"}, ) )
View Source
var ( Logout = NewEndpointMetrics( "logout", []string{"client_id", "username", "redirect_uri"}, []string{"client_id"}, ) )
View Source
var ( Token = NewEndpointMetrics( "token", []string{"grant_type", "client_id", "username", "scope"}, []string{"grant_type"}, ) )
View Source
var ( Userinfo = NewEndpointMetrics( "userinfo", []string{"client_id", "username", "scope"}, []string{"client_id"}, ) )
Functions ¶
Types ¶
type Context ¶
type Context struct { Error error Metrics *EndpointMetrics Labels prometheus.Labels Method string Path string Remote string // contains filtered or unexported fields }
func StartAuthz ¶
func StartLogout ¶ added in v0.1.0
func StartToken ¶
func StartUserinfo ¶
func (*Context) ClientError ¶ added in v0.1.0
func (c *Context) ClientError()
ClientError is client side error except UserError.
func (*Context) Continue ¶ added in v0.1.0
func (c *Context) Continue()
Continue is succeed process but not done.
func (*Context) ServerError ¶ added in v0.1.0
func (c *Context) ServerError()
ServerError is internal server error.
type EndpointMetrics ¶
type EndpointMetrics struct { Name string Labels []string TimerLabels []string Latency *prometheus.SummaryVec Count *prometheus.CounterVec }
func NewEndpointMetrics ¶
func NewEndpointMetrics(name string, labels []string, timerLabels []string) *EndpointMetrics
func (*EndpointMetrics) MustRegister ¶
func (em *EndpointMetrics) MustRegister()
type ErrorReporter ¶
type LogContext ¶
type LogContext struct { Method string Path string Remote string Err error Error string Description string Latency float64 // contains filtered or unexported fields }
func StartLogging ¶
func StartLogging(ctx *gin.Context) *LogContext
func (*LogContext) Close ¶
func (c *LogContext) Close() error
func (*LogContext) Observe ¶
func (c *LogContext) Observe(v float64)
func (*LogContext) SetError ¶
func (c *LogContext) SetError(err error, reason, description string)
type ResponseCollcetor ¶
type ResponseCollcetor struct { Upstream http.ResponseWriter Code int }
func (*ResponseCollcetor) Header ¶
func (w *ResponseCollcetor) Header() http.Header
func (*ResponseCollcetor) StatusClass ¶
func (w *ResponseCollcetor) StatusClass() string
func (*ResponseCollcetor) WriteHeader ¶
func (w *ResponseCollcetor) WriteHeader(statusCode int)
Click to show internal directories.
Click to hide internal directories.