Documentation
¶
Index ¶
- Constants
- Variables
- func AuthUserMiddleware(redirect bool) gin.HandlerFunc
- func AvatarHTML(s string) template.HTML
- func DeleteTGC(c *gin.Context)
- func GetTGC(c *gin.Context) *cas.Ticket
- func IsAjax(r *http.Request) bool
- func LoadPrivateKey(data []byte) (interface{}, error)
- func New(c Config) *server
- func NewTGC(c *gin.Context, ticket *cas.Ticket)
- func RequestScheme(r *http.Request) string
- func SessionLoad(r *http.Request) session.Session
- func SessionSave(sess session.Session, w http.ResponseWriter)
- func SetBase(s string)
- func UrlFor(path string) string
- func UserFromStaff(staff *models.Staff) *auth.User
- type AccessTokenGenJWT
- type Config
- type IDToken
- type User
Constants ¶
View Source
const ( LimitArticle = 3 LimitLinks = 10 )
View Source
const ( ERROR_DB = 1 ERROR_PARAM = 2 ERROR_INTERNAL = 3 ERROR_LIMIT = 4 )
Variables ¶
View Source
var ( // MsgPack is a Codec that uses the `ugorji/go/codec` package. MsgPack = scodec.Codec{Marshal: msgPackMarshal, Unmarshal: msgPackUnmarshal} )
Functions ¶
func AuthUserMiddleware ¶ added in v0.6.3
func AuthUserMiddleware(redirect bool) gin.HandlerFunc
func AvatarHTML ¶ added in v0.8.2
AvatarHTML 生成头像的HTML标签,目前仅支持微信头像
func LoadPrivateKey ¶ added in v0.12.4
LoadPrivateKey loads a private key from PEM/DER data.
func RequestScheme ¶ added in v0.12.4
func SessionSave ¶ added in v0.8.1
func SessionSave(sess session.Session, w http.ResponseWriter)
Types ¶
type AccessTokenGenJWT ¶
type AccessTokenGenJWT struct {
Key []byte
}
AccessTokenGenJWT JWT access token generator
func (*AccessTokenGenJWT) GenerateAccessToken ¶
func (c *AccessTokenGenJWT) GenerateAccessToken(data *osin.AccessData, generaterefresh bool) (accesstoken string, refreshtoken string, err error)
type IDToken ¶ added in v0.12.3
type IDToken struct { Issuer string `json:"iss"` UserID string `json:"sub"` ClientID string `json:"aud"` Expiration int64 `json:"exp"` IssuedAt int64 `json:"iat"` Nonce string `json:"nonce,omitempty"` // Non-manditory fields MUST be "omitempty" Email string `json:"email,omitempty"` EmailVerified *bool `json:"email_verified,omitempty"` UID string `json:"uid,omitempty"` Name string `json:"name,omitempty"` FamilyName string `json:"family_name,omitempty"` GivenName string `json:"given_name,omitempty"` Locale string `json:"locale,omitempty"` BirthDate string `json:"birthdate,omitempty"` Gender string `json:"gender,omitempty"` Nickname string `json:"nickname,omitempty"` PhoneNumber string `json:"phone_number,omitempty"` }
IDToken The ID Token represents a JWT passed to the client as part of the token response.
https://openid.net/specs/openid-connect-core-1_0.html#IDToken
Source Files
¶
- auth.go
- docs.go
- handle_admin.go
- handle_basic.go
- handle_cas.go
- handle_content.go
- handle_exmail.go
- handle_oauth.go
- handle_status.go
- handle_team.go
- handle_third_lark.go
- handle_third_wechat.go
- handle_wechat_checkin.go
- handle_weekly.go
- jwt.go
- router.go
- schema.go
- schema_openid.go
- server.go
- session.go
- template.go
Click to show internal directories.
Click to hide internal directories.