Documentation ¶
Index ¶
- Constants
- Variables
- func ActiveTicketWithMFA(ticket models.AuthTicket, factor models.AuthFactor, code string) (models.AuthTicket, error)
- func ActiveTicketWithPassword(ticket models.AuthTicket, password string) (models.AuthTicket, error)
- func AddEvent(user models.Account, event, target, ip, ua string) models.ActionEvent
- func AddNotifySubscriber(user models.Account, provider, device, ua string) (models.NotificationSubscriber, error)
- func AddRealmMember(user models.Account, affected models.Account, target models.Realm) error
- func Authenticate(access, refresh string, depth int) (user models.Account, newAccess, newRefresh string, err error)
- func CheckFactor(factor models.AuthFactor, code string) error
- func CheckOnline(user models.Account) bool
- func ConfirmAccount(code string) error
- func CountUserFactor(userId uint) int64
- func CreateAccount(name, nick, email, password string) (models.Account, error)
- func DeleteFriend(relationship models.AccountFriendship) error
- func DeleteRealm(realm models.Realm) error
- func DetectRisk(user models.Account, ip, ua string) bool
- func DoAutoAuthCleanup()
- func DoAutoDatabaseCleanup()
- func DoAutoSignoff()
- func EditFriend(relationship models.AccountFriendship) (models.AccountFriendship, error)
- func EditFriendWithCheck(relationship models.AccountFriendship, user models.Account, ...) (models.AccountFriendship, error)
- func EditRealm(realm models.Realm) (models.Realm, 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 GetAccount(id uint) (models.Account, error)
- func GetAuthContext(jti string) (models.AuthContext, error)
- func GetFactor(id uint) (models.AuthFactor, error)
- func GetFactorCode(factor models.AuthFactor) (bool, error)
- func GetFactorName(w models.AuthFactorType, localizer *i18n.Localizer) string
- func GetFriend(anysideId uint) (models.AccountFriendship, error)
- func GetFriendWithTwoSides(userId, relatedId uint, noPreload ...bool) (models.AccountFriendship, error)
- func GetPasswordTypeFactor(userId uint) (models.AuthFactor, error)
- func GetRealmMember(userId uint, realmId uint) (models.RealmMember, error)
- func GetRealmWithAlias(alias string) (models.Realm, error)
- func GetThirdClient(id string) (models.ThirdClient, error)
- func GetThirdClientWithSecret(id, secret string) (models.ThirdClient, error)
- func GetTicket(id uint) (models.AuthTicket, error)
- func GetTicketWithToken(tokenId string) (models.AuthTicket, error)
- func GetToken(ticket models.AuthTicket) (string, string, error)
- func GrantAuthContext(jti string) (models.AuthContext, error)
- func HashPassword(raw string) string
- func ListAllFriend(anyside models.Account) ([]models.AccountFriendship, error)
- func ListAvailableRealm(user models.Account) ([]models.Realm, error)
- func ListCommunityRealm() ([]models.Realm, error)
- func ListFriend(anyside models.Account, status models.FriendshipStatus) ([]models.AccountFriendship, error)
- func ListOwnedRealm(user models.Account) ([]models.Realm, error)
- func ListRealmMember(realmId uint) ([]models.RealmMember, error)
- func ListUserFactor(userId uint) ([]models.AuthFactor, error)
- func LookupAccount(probe string) (models.Account, error)
- func NewFriend(user models.Account, related models.Account, status models.FriendshipStatus) (models.AccountFriendship, error)
- func NewMagicToken(mode models.MagicTokenType, assignTo *models.Account, expiredAt *time.Time) (models.MagicToken, error)
- func NewNotification(notification models.Notification) error
- func NewOauthTicket(user models.Account, client models.ThirdClient, claims, audiences []string, ...) (models.AuthTicket, error)
- func NewRealm(realm models.Realm, user models.Account) (models.Realm, error)
- func NewTicket(user models.Account, ip, ua string) (models.AuthTicket, error)
- func NotifyMagicToken(token models.MagicToken) error
- func PushNotification(notification models.Notification) error
- func RefreshToken(token string) (string, string, error)
- func RegenSession(ticket models.AuthTicket) (models.AuthTicket, error)
- func RemoveRealmMember(user models.Account, affected models.Account, target models.Realm) error
- func RevokeAuthContext(jti string) error
- func SendMail(target string, subject string, content string) error
- func SendMailHTML(target string, subject string, content string) error
- func SetJwtCookieSet(c *fiber.Ctx, access, refresh string)
- func ValidateMagicToken(code string, mode models.MagicTokenType) (models.MagicToken, error)
- func VerifyPassword(text string, password string) bool
- type PayloadClaims
- type WsPushRequest
Constants ¶
View Source
const ( JwtAccessType = "access" JwtRefreshType = "refresh" )
View Source
const ConfirmRegistrationTemplate = `` /* 600-byte string literal not displayed */
View Source
const EmailPasswordTemplate = `` /* 534-byte string literal not displayed */
Variables ¶
View Source
var CookieAccessKey = "passport_auth_key"
View Source
var CookieRefreshKey = "passport_refresh_key"
View Source
var WsConn = make(map[uint][]*websocket.Conn)
Functions ¶
func ActiveTicketWithMFA ¶
func ActiveTicketWithMFA(ticket models.AuthTicket, factor models.AuthFactor, code string) (models.AuthTicket, error)
func ActiveTicketWithPassword ¶
func ActiveTicketWithPassword(ticket models.AuthTicket, password string) (models.AuthTicket, error)
func AddNotifySubscriber ¶
func AddRealmMember ¶
func Authenticate ¶
func CheckFactor ¶
func CheckFactor(factor models.AuthFactor, code string) error
func CheckOnline ¶
func ConfirmAccount ¶
func CountUserFactor ¶
func DeleteFriend ¶
func DeleteFriend(relationship models.AccountFriendship) error
func DeleteRealm ¶
func DoAutoAuthCleanup ¶
func DoAutoAuthCleanup()
func DoAutoDatabaseCleanup ¶
func DoAutoDatabaseCleanup()
func DoAutoSignoff ¶
func DoAutoSignoff()
func EditFriend ¶
func EditFriend(relationship models.AccountFriendship) (models.AccountFriendship, error)
func EditFriendWithCheck ¶
func EditFriendWithCheck(relationship models.AccountFriendship, user models.Account, originalStatus models.FriendshipStatus) (models.AccountFriendship, error)
func ExchangeOauthToken ¶
func GetAuthContext ¶
func GetAuthContext(jti string) (models.AuthContext, error)
func GetFactorCode ¶
func GetFactorCode(factor models.AuthFactor) (bool, error)
func GetFactorName ¶
func GetFactorName(w models.AuthFactorType, localizer *i18n.Localizer) string
func GetFriendWithTwoSides ¶
func GetFriendWithTwoSides(userId, relatedId uint, noPreload ...bool) (models.AccountFriendship, error)
func GetPasswordTypeFactor ¶
func GetPasswordTypeFactor(userId uint) (models.AuthFactor, error)
func GetRealmMember ¶
func GetRealmMember(userId uint, realmId uint) (models.RealmMember, error)
func GetThirdClient ¶
func GetThirdClient(id string) (models.ThirdClient, error)
func GetThirdClientWithSecret ¶
func GetThirdClientWithSecret(id, secret string) (models.ThirdClient, error)
func GetTicketWithToken ¶
func GetTicketWithToken(tokenId string) (models.AuthTicket, error)
func GrantAuthContext ¶
func GrantAuthContext(jti string) (models.AuthContext, error)
func HashPassword ¶
func ListAllFriend ¶
func ListAllFriend(anyside models.Account) ([]models.AccountFriendship, error)
func ListCommunityRealm ¶
func ListFriend ¶
func ListFriend(anyside models.Account, status models.FriendshipStatus) ([]models.AccountFriendship, error)
func ListRealmMember ¶
func ListRealmMember(realmId uint) ([]models.RealmMember, error)
func ListUserFactor ¶
func ListUserFactor(userId uint) ([]models.AuthFactor, error)
func NewFriend ¶
func NewFriend(user models.Account, related models.Account, status models.FriendshipStatus) (models.AccountFriendship, error)
func NewMagicToken ¶
func NewMagicToken(mode models.MagicTokenType, assignTo *models.Account, expiredAt *time.Time) (models.MagicToken, error)
func NewNotification ¶
func NewNotification(notification models.Notification) error
func NewOauthTicket ¶
func NewOauthTicket( user models.Account, client models.ThirdClient, claims, audiences []string, ip, ua string, ) (models.AuthTicket, error)
func NotifyMagicToken ¶
func NotifyMagicToken(token models.MagicToken) error
func PushNotification ¶
func PushNotification(notification models.Notification) error
func RegenSession ¶
func RegenSession(ticket models.AuthTicket) (models.AuthTicket, error)
func RemoveRealmMember ¶
func RevokeAuthContext ¶
func SetJwtCookieSet ¶
func SetJwtCookieSet(c *fiber.Ctx, access, refresh string)
func ValidateMagicToken ¶
func ValidateMagicToken(code string, mode models.MagicTokenType) (models.MagicToken, 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)
type WsPushRequest ¶
Click to show internal directories.
Click to hide internal directories.