oauth

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MeZjutURL         = "http://www.me.zjut.edu.cn"
	PersonalCenterURL = MeZjutURL + "/personal-center"
	UserInfoApi       = MeZjutURL + "/api/basic/info"
)

用户中心

View Source
const (
	BaseUrl      = "https://oauth.zjut.edu.cn/cas"
	PublicKeyUrl = BaseUrl + "/v2/getPubKey"
	LoginUrl     = BaseUrl + "/login"
)

统一登陆

View Source
const (
	WrongPasswordMsg = "用户名或密码错误" // #nosec G101
	WrongAccountMsg  = "当前账号无权登录"
	NotActivatedMsg  = "账号未激活,请激活后再登录"
)

登陆错误对应在页面的提示信息

Variables

This section is empty.

Functions

func Login

func Login(username, password string) ([]*http.Cookie, error)

Login 统一登陆

Types

type UserInfo

type UserInfo struct {
	College   string `json:"bmmc"`
	Grade     string `json:"jsmc"`
	Name      string `json:"nc"`
	StudentID string `json:"yhm"`
}

UserInfo 用户信息

func GetUserInfo

func GetUserInfo(username, password string) (cookies []*http.Cookie, userInfo UserInfo, err error)

GetUserInfo 登陆并获取用户信息

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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