juanjiCAS

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

README

juanjiCAS-Go-SDK

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotSetSendKey  = errors.New("not set send key")
	ErrInvalidSendKey = errors.New("invalid send key")
	ErrUnknown        = errors.New("unknown error")
	ErrServerErr      = errors.New("server error")
)

Functions

This section is empty.

Types

type CAS

type CAS struct {
	// contains filtered or unexported fields
}

func New

func New(domain ...string) *CAS

func (*CAS) GetLoginURL

func (c *CAS) GetLoginURL(redirectURL string) string

func (*CAS) GetLogoutURL

func (c *CAS) GetLogoutURL(redirectURL string) string

func (*CAS) GetValidateURL

func (c *CAS) GetValidateURL(ticket string, redirectURL string) string

func (*CAS) Notify added in v0.2.0

func (c *CAS) Notify(notice *Notice) error

func (*CAS) SetDomain

func (c *CAS) SetDomain(domain string) *CAS

SetDomain set backend domain

func (*CAS) SetFrontendDomain added in v1.0.1

func (c *CAS) SetFrontendDomain(domain string) *CAS

SetFrontendDomain set frontend domain

func (*CAS) SetSendKey added in v0.2.0

func (c *CAS) SetSendKey(sendKey string) *CAS

func (*CAS) Validate

func (c *CAS) Validate(ticket string, redirectURL string) (CasServiceResponse, error)

Validate redirectURL is the service url

type CasAnyAttribute added in v1.0.0

type CasAnyAttribute struct {
	XMLName xml.Name
	Value   string `xml:",chardata"`
}

type CasAttributes added in v1.0.0

type CasAttributes struct {
	XMLName                                xml.Name  `xml:"cas:attributes" json:"-"`
	AuthenticationDate                     time.Time `xml:"cas:authenticationDate"`
	LongTermAuthenticationRequestTokenUsed bool      `xml:"cas:longTermAuthenticationRequestTokenUsed"`
	IsFromNewLogin                         bool      `xml:"cas:isFromNewLogin"`
	MemberOf                               []string  `xml:"cas:memberOf"`
	UserAttributes                         *CasUserAttributes
	ExtraAttributes                        []*CasAnyAttribute `xml:",any"`
}

type CasAuthenticationFailure added in v1.0.0

type CasAuthenticationFailure struct {
	XMLName xml.Name `xml:"cas:authenticationFailure" json:"-"`
	Code    string   `xml:"code,attr"`
	Message string   `xml:",innerxml"`
}

type CasAuthenticationSuccess added in v1.0.0

type CasAuthenticationSuccess struct {
	XMLName             xml.Name           `xml:"cas:authenticationSuccess" json:"-"`
	User                string             `xml:"cas:user"`
	ProxyGrantingTicket string             `xml:"cas:proxyGrantingTicket,omitempty"`
	Proxies             *CasProxies        `xml:"cas:proxies"`
	Attributes          *CasAttributes     `xml:"cas:attributes"`
	ExtraAttributes     []*CasAnyAttribute `xml:",any"`
}

type CasNamedAttribute added in v1.0.0

type CasNamedAttribute struct {
	XMLName xml.Name `xml:"cas:attribute" json:"-"`
	Name    string   `xml:"name,attr,omitempty"`
	Value   string   `xml:",innerxml"`
}

type CasProxies added in v1.0.0

type CasProxies struct {
	XMLName xml.Name `xml:"cas:proxies" json:"-"`
	Proxies []string `xml:"cas:proxy"`
}

type CasProxyFailure added in v1.0.0

type CasProxyFailure struct {
	XMLName xml.Name `xml:"cas:proxyFailure" json:"-"`
	Code    string   `xml:"code,attr"`
	Message string   `xml:",innerxml"`
}

type CasProxySuccess added in v1.0.0

type CasProxySuccess struct {
	XMLName     xml.Name `xml:"cas:proxySuccess" json:"-"`
	ProxyTicket string   `xml:"cas:proxyTicket"`
}

type CasServiceResponse added in v1.0.0

type CasServiceResponse struct {
	XMLName      xml.Name `xml:"cas:serviceResponse" json:"-"`
	Xmlns        string   `xml:"xmlns:cas,attr"`
	Failure      *CasAuthenticationFailure
	Success      *CasAuthenticationSuccess
	ProxySuccess *CasProxySuccess
	ProxyFailure *CasProxyFailure
}

type CasUserAttributes added in v1.0.0

type CasUserAttributes struct {
	XMLName       xml.Name             `xml:"cas:userAttributes" json:"-"`
	Attributes    []*CasNamedAttribute `xml:"cas:attribute"`
	AnyAttributes []*CasAnyAttribute   `xml:",any"`
}

type Notice added in v0.2.0

type Notice struct {
	Title string `json:"title"`
	Body  string `json:"body"`
	Url   string `json:"url"`  // 详情链接
	To    string `json:"to"`   // UID 仅当推送为服务推送时该字段生效
	From  string `json:"from"` // 服务名 仅当推送为个人推送时该字段生效
}

func NewNotice added in v0.2.0

func NewNotice(title, body, url string) *Notice

func (*Notice) SetFrom added in v0.2.0

func (n *Notice) SetFrom(from string) *Notice

SetFrom 设置推送来源 仅当推送为个人推送时该设置有用

func (*Notice) SetTo added in v0.2.0

func (n *Notice) SetTo(to string) *Notice

SetTo 设置推送目标 仅当推送为服务推送时该设置有用

type Resp added in v0.2.0

type Resp struct {
	Code  int         `json:"code"`
	Msg   string      `json:"msg"`
	Count int64       `json:"count,omitempty"`
	Data  interface{} `json:"data,omitempty"`
}

Jump to

Keyboard shortcuts

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