Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewGatewayAuthService ¶
func NewGatewayAuthService(ctx context.Context, listen string, handler AuthHandler)
NewGatewayAuthService initializes a new instance from the auth service. The third parameter is the callback function for authentication requests. There you can block or allow pass-trough requests with additional header manipulation.
Types ¶
type AuthHandler ¶
type AuthHandler func(*AuthRequest) error
type AuthRequest ¶
type AuthRequest struct { ContentType string Method string Host string URL string Header http.Header // contains filtered or unexported fields }
AuthRequest authorization request from the Gateway service. You can block or allow pass-trough with Passtrough and BlockWithContent or BlockWithError methods.
func (*AuthRequest) BlockWithContent ¶
func (ar *AuthRequest) BlockWithContent(status int, contentType string, content []byte)
BlockWithError blocks the request with specific content.
func (*AuthRequest) BlockWithError ¶
func (ar *AuthRequest) BlockWithError(status int, message string)
BlockWithError block the request with plain text error.
func (*AuthRequest) Passtrough ¶
func (ar *AuthRequest) Passtrough(additionalHeaders http.Header)
Passtrough allow the gateway to send the data to the upstream.
type AuthResult ¶
type AuthResult struct { // Block indicates wether the request should be blocked or not. Block bool // contains filtered or unexported fields }
func (AuthResult) AddHeaders ¶
func (ar AuthResult) AddHeaders(h http.Header)
AddHeaders sets additional headers which sent by the auth server.
func (AuthResult) RenderError ¶
func (ar AuthResult) RenderError(wr http.ResponseWriter) error
func (AuthResult) String ¶
func (ar AuthResult) String() string
type AuthService ¶
type AuthService struct { }
Click to show internal directories.
Click to hide internal directories.