github

package
v0.4.33 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Name      = "github"
	Config    = Name + "config"
	TokenType = Name + "jwt"
	UserType  = Name + "_user"
	OrgType   = Name + "_org"
	TeamType  = Name + "_team"
)

Constants for github

Variables

This section is empty.

Functions

func GetUserIdentity

func GetUserIdentity(identities []client.Identity, userType string) (client.Identity, bool)

GetUserIdentity returns the "user" from the list of identities

func URLEncoded

func URLEncoded(str string) string

URLEncoded encodes the string

Types

type Account

type Account struct {
	ID        int    `json:"id,omitempty"`
	Login     string `json:"login,omitempty"`
	Name      string `json:"name,omitempty"`
	AvatarURL string `json:"avatar_url,omitempty"`
	HTMLURL   string `json:"html_url,omitempty"`
}

Account defines properties an account on github has

type GClient

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

GClient implements a httpclient for github

type GProvider

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

GProvider implements an IdentityProvider for github

func InitializeProvider

func InitializeProvider() (*GProvider, error)

InitializeProvider returns a new instance of the provider

func (*GProvider) AddProviderConfig

func (g *GProvider) AddProviderConfig(authConfig *model.AuthConfig, providerSettings map[string]string)

AddProviderConfig adds the provider config into the generic config using the settings from db

func (*GProvider) CustomizeSchema added in v0.4.3

func (g *GProvider) CustomizeSchema(schema *v1client.Schema) *v1client.Schema

func (*GProvider) GenerateToken

func (g *GProvider) GenerateToken(json map[string]string) (model.Token, int, error)

GenerateToken authenticates the given code and returns the token

func (*GProvider) GetConfig

func (g *GProvider) GetConfig() model.AuthConfig

GetConfig returns the provider config

func (*GProvider) GetIdentities

func (g *GProvider) GetIdentities(accessToken string) ([]client.Identity, error)

GetIdentities returns list of user and group identities associated to this token

func (*GProvider) GetIdentity

func (g *GProvider) GetIdentity(externalID string, externalIDType string, accessToken string) (client.Identity, error)

GetIdentity returns the identity by externalID and externalIDType

func (*GProvider) GetIdentitySeparator added in v0.1.0

func (g *GProvider) GetIdentitySeparator() string

GetIdentitySeparator returns the provider specific separator to use to separate allowedIdentities

func (*GProvider) GetLegacySettings

func (g *GProvider) GetLegacySettings() map[string]string

GetLegacySettings returns the provider specific legacy db settings

func (*GProvider) GetName

func (g *GProvider) GetName() string

GetName returns the name of the provider

func (*GProvider) GetProviderConfigResource added in v0.4.3

func (g *GProvider) GetProviderConfigResource() interface{}

func (*GProvider) GetProviderSecretSettings added in v0.4.10

func (g *GProvider) GetProviderSecretSettings() []string

func (*GProvider) GetProviderSettingList

func (g *GProvider) GetProviderSettingList(listOnly bool) []string

GetProviderSettingList returns the provider specific db setting list

func (*GProvider) GetRedirectURL

func (g *GProvider) GetRedirectURL() string

GetRedirectURL returns the provider specific redirect URL used by UI

func (*GProvider) GetSettings

func (g *GProvider) GetSettings() map[string]string

GetSettings transforms the provider config to db settings

func (*GProvider) GetUserType

func (g *GProvider) GetUserType() string

GetUserType returns the string used to identify a user account for this provider

func (*GProvider) IsIdentityLookupSupported added in v0.4.10

func (g *GProvider) IsIdentityLookupSupported() bool

func (*GProvider) LoadConfig

func (g *GProvider) LoadConfig(authConfig *model.AuthConfig) error

LoadConfig initializes the provider with the passes config

func (*GProvider) RefreshToken

func (g *GProvider) RefreshToken(json map[string]string) (model.Token, int, error)

RefreshToken re-authenticates and generate a new token

func (*GProvider) SearchIdentities

func (g *GProvider) SearchIdentities(name string, exactMatch bool, accessToken string) ([]client.Identity, error)

SearchIdentities returns the identity by name

func (*GProvider) TestLogin added in v0.4.3

func (g *GProvider) TestLogin(testAuthConfig *model.TestAuthConfig, accessToken string, originalLogin string) (int, error)

type Team

type Team struct {
	ID           int                    `json:"id,omitempty"`
	Organization map[string]interface{} `json:"organization,omitempty"`
	Name         string                 `json:"name,omitempty"`
	Slug         string                 `json:"slug,omitempty"`
}

Team defines properties a team on github has

Jump to

Keyboard shortcuts

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