Documentation ¶
Index ¶
- Constants
- func GetAccessToken(c *gin.Context) (tks string, err error)
- func GetUserClaims(c *gin.Context) (*tokens.Claims, error)
- func GetUserID(c *gin.Context) (int64, error)
- func SetAuthCookies(c *gin.Context, accessToken, refreshToken, domain string) (err error)
- type Server
- func (s *Server) Authenticate(c *gin.Context)
- func (s *Server) Authorize(permissions ...string) gin.HandlerFunc
- func (s *Server) Available() gin.HandlerFunc
- func (s *Server) CreateReading(c *gin.Context)
- func (s *Server) DeleteReading(c *gin.Context)
- func (s *Server) FetchReading(c *gin.Context)
- func (s *Server) JWKS(c *gin.Context)
- func (s *Server) ListReadings(c *gin.Context)
- func (s *Server) Login(c *gin.Context)
- func (s *Server) Logout(c *gin.Context)
- func (s *Server) OpenIDConfiguration(c *gin.Context)
- func (s *Server) Register(c *gin.Context)
- func (s *Server) SecurityTxt(c *gin.Context)
- func (s *Server) Serve() (err error)
- func (s *Server) SetHealth(health bool)
- func (s *Server) SetURL(url string)
- func (s *Server) Shutdown() (err error)
- func (s *Server) Status(c *gin.Context)
- func (s *Server) URL() string
- func (s *Server) UpdateReading(c *gin.Context)
Constants ¶
const ( UserClaims = "user_claims" AccessTokenCookie = "access_token" RefreshTokenCookie = "refresh_token" )
Variables ¶
This section is empty.
Functions ¶
func SetAuthCookies ¶ added in v0.3.0
SetAuthCookies is a helper function that sets access and refresh token cookies on a gin request. The access token cookie (access_token) is an http only cookie that expires when the access token expires. The refresh token cookie is an http only cookie (it can't be accessed by client-side scripts) and it expires when the refresh token expires. Both cookies require https and will not be set (silently) over http.
Types ¶
type Server ¶
func (*Server) Authenticate ¶
func (*Server) Available ¶
func (s *Server) Available() gin.HandlerFunc
Available is middleware that uses the healthy boolean to return a service unavailable http status code if the server is shutting down. This middleware must be first in the chain to ensure that complex handling to slow the shutdown of the server.
func (*Server) CreateReading ¶
func (*Server) DeleteReading ¶
func (*Server) FetchReading ¶
func (*Server) JWKS ¶
JWKS returns the JSON web key set for the public RSA keys that are currently being used by Epistolary to sign JWT acccess and refresh tokens. External callers can use these keys to verify that a JWT token was in fact issued by the Epistolary API.
func (*Server) ListReadings ¶
func (*Server) OpenIDConfiguration ¶
Returns a JSON document with the OpenID configuration as defined by the OpenID Connect standard: https://connect2id.com/learn/openid-connect. This document helps clients understand how to authenticate with Epistolary. TODO: once OpenID endpoints have been configured add them to this JSON response
func (*Server) SecurityTxt ¶
Writes the security.txt file generated from https://securitytxt.org/ and digitally signed with the info@rotational.io PGP keys to alert security researchers to our security policies and allow them to contact us with any security flaws.