Documentation ¶
Index ¶
- Constants
- Variables
- func CalcRisk(user models.Account, ip, ua string) int
- func DoChallenge(challenge models.AuthChallenge, factor models.AuthFactor, code string) error
- func EncodeJwt(id string, typ, sub, sed string, aud []string, exp time.Time) (string, error)
- func ExchangeOauthToken(clientId, clientSecret, redirectUri, token string) (string, string, error)
- func ExchangeToken(token string) (string, string, error)
- func GetToken(session models.AuthSession) (string, string, error)
- func GrantOauthSession(user models.Account, client models.ThirdClient, claims, audiences []string, ...) (models.AuthSession, error)
- func GrantSession(challenge models.AuthChallenge, claims, audiences []string, ...) (models.AuthSession, error)
- func HashPassword(raw string) string
- func NewChallenge(user models.Account, factors []models.AuthFactor, ip, ua string) (models.AuthChallenge, error)
- func RefreshToken(token string) (string, string, error)
- func RegenSession(session models.AuthSession) (models.AuthSession, error)
- func SetJwtCookieSet(c *fiber.Ctx, access, refresh string)
- func VerifyFactor(factor models.AuthFactor, code string) error
- func VerifyPassword(text string, password string) bool
- type PayloadClaims
Constants ¶
View Source
const ( JwtAccessType = "access" JwtRefreshType = "refresh" )
Variables ¶
View Source
var CookieAccessKey = "identity_auth_key"
View Source
var CookieRefreshKey = "identity_refresh_key"
Functions ¶
func DoChallenge ¶
func DoChallenge(challenge models.AuthChallenge, factor models.AuthFactor, code string) error
func ExchangeOauthToken ¶
func GrantOauthSession ¶
func GrantSession ¶
func GrantSession(challenge models.AuthChallenge, claims, audiences []string, expired, available *time.Time) (models.AuthSession, error)
func HashPassword ¶
func NewChallenge ¶
func NewChallenge(user models.Account, factors []models.AuthFactor, ip, ua string) (models.AuthChallenge, error)
func RegenSession ¶
func RegenSession(session models.AuthSession) (models.AuthSession, error)
func SetJwtCookieSet ¶
func SetJwtCookieSet(c *fiber.Ctx, access, refresh string)
func VerifyFactor ¶
func VerifyFactor(factor models.AuthFactor, code string) error
func VerifyPassword ¶
Types ¶
type PayloadClaims ¶
type PayloadClaims struct { jwt.RegisteredClaims SessionID string `json:"sed"` Type string `json:"typ"` }
func DecodeJwt ¶
func DecodeJwt(str string) (PayloadClaims, error)
Click to show internal directories.
Click to hide internal directories.