staffio

package
v0.0.0-...-022d024 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2017 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyState = "_state"
	KeyToken = "_tok"
)

Variables

This section is empty.

Functions

func AuthCodeCallback

func AuthCodeCallback() gin.HandlerFunc

auth callback with authCode

func AuthToken

func AuthToken() gin.HandlerFunc

func GetAuthCodeURL

func GetAuthCodeURL(state string) string

func GetAuthTokenURL

func GetAuthTokenURL(state string) string

func GroupCheck

func GroupCheck(name string) gin.HandlerFunc

func LoginHandler

func LoginHandler(ctx *gin.Context)

func Setup

func Setup(redirectURL, clientID, clientSecret string, scopes []string)

Setup oauth2 config

func TokenHandler

func TokenHandler(ctx *gin.Context)

Types

type InfoToken

type InfoToken struct {
	AccessToken  string    `json:"access_token"`
	TokenType    string    `json:"token_type,omitempty"`
	RefreshToken string    `json:"refresh_token,omitempty"`
	ExpiresIn    int64     `json:"expires_in,omitempty"`
	Expiry       time.Time `json:"expiry,omitempty"`
	Me           User      `json:"me,omitempty"`
}

func (*InfoToken) GetAuthedUrl

func (tok *InfoToken) GetAuthedUrl(authUrl string) string

for redux-auth

func (*InfoToken) GetExpiry

func (tok *InfoToken) GetExpiry() time.Time

type User

type User struct {
	Uid            string `json:"uid"`                                // 登录名
	CommonName     string `json:"cn,omitempty"`                       // 全名
	GivenName      string `json:"gn" form:"gn" binding:"required"`    // 名
	Surname        string `json:"sn" form:"sn" binding:"required"`    // 姓
	Nickname       string `json:"nickname,omitempty" form:"nickname"` // 昵称
	Birthday       string `json:"birthday,omitempty" form:"birthday"` // 生日
	Gender         uint8  `json:"gender,omitempty"`                   // 1=male, 2=female, 0=unknown
	Mobile         string `json:"mobile,omitempty"`
	Email          string `json:"email,omitempty"`
	EmployeeNumber string `json:"eid,omitempty" form:"eid"`
	EmployeeType   string `json:"etype,omitempty" form:"etitle"`
	AvatarPath     string `json:"avatarPath,omitempty" form:"avatar"`
	Provider       string `json:"provider"`
}

User is a retrieved and authenticated user.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL