sso

package
v3.2.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessToken

type AccessToken struct {
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type"`
	ExpiresIn    int    `json:"expires_in"`
	RefreshToken string `json:"refresh_token"`
}

AccessToken denotes the response of https://${sso.domain}/oauth2/token

type Client

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

Client communicate with the SSO service

func NewClient

func NewClient(s config.SSO, httpClient *http.Client) *Client

NewClient return an initialized Client struct pointer

func (Client) GetAccessToken

func (c Client) GetAccessToken(authorizationCode string) (*AccessToken, error)

GetAccessToken get accessToken from SSO

func (Client) GetEntryOwnerEmails

func (c Client) GetEntryOwnerEmails() ([]string, error)

GetEntryOwnerEmails get emails of the owners of entry

func (Client) GetGroup

func (c Client) GetGroup(groupName string) (*Group, error)

GetGroup get group info from sso

func (Client) GetMe

func (c Client) GetMe(accessToken string) (*User, error)

GetMe get user from SSO according to accessToken

func (Client) GetUser

func (c Client) GetUser(userName string) (*User, error)

GetUser get user info from sso

func (Client) IsEntryOwner

func (c Client) IsEntryOwner(user User) bool

IsEntryOwner judge whether user is entry's owner

type Group

type Group struct {
	Members      []Member      `json:"members"`
	GroupMembers []GroupMember `json:"group_members"`
}

Group denotes the response of https://${sso.domain}/api/groups/{groupname}

type GroupMember

type GroupMember struct {
	Name     string `json:"name"`
	Fullname string `json:"fullname"`
	Role     string `json:"role"`
}

GroupMember denotes the subgroup of group

type Member

type Member struct {
	Name string `json:"name"`
	Role string `json:"role"`
}

Member denotes the member of group

type User

type User struct {
	Email  string   `json:"email"`
	Groups []string `json:"groups"`
}

User denotes sso user

Jump to

Keyboard shortcuts

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