gitlab

package
v0.0.0-...-4b6c822 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GitlabProvider

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

GitlabProvider implements the Provider interface and provides Gitlab OAuth2 communication capabilities.

func New

func New(clientId, clientSecret, redirectUrl string) *GitlabProvider

func (*GitlabProvider) CompleteAuth

func (provider *GitlabProvider) CompleteAuth(data objx.Map) (*common.Credentials, error)

CompleteAuth takes a map of arguments that are used to complete the authorisation process, completes it, and returns the appropriate Credentials.

func (*GitlabProvider) DisplayName

func (provider *GitlabProvider) DisplayName() string

DisplayName is the human readable name for this provider.

func (*GitlabProvider) Get

func (provider *GitlabProvider) Get(creds *common.Credentials, endpoint string) (objx.Map, error)

Get makes an authenticated request and returns the data in the response as a data map.

func (*GitlabProvider) GetBeginAuthURL

func (provider *GitlabProvider) GetBeginAuthURL(state *common.State, options objx.Map) (string, error)

GetBeginAuthURL gets the URL that the client must visit in order to begin the authentication process.

The state argument contains anything you wish to have sent back to your callback endpoint. The options argument takes any options used to configure the auth request sent to the provider. In the case of OAuth2, the options map can contain:

  1. A "scope" key providing the desired scope(s). It will be merged with the default scope.

func (*GitlabProvider) GetClient

func (provider *GitlabProvider) GetClient(creds *common.Credentials) (*http.Client, error)

GetClient returns an authenticated http.Client that can be used to make requests to protected Github resources

func (*GitlabProvider) GetUser

func (provider *GitlabProvider) GetUser(creds *common.Credentials) (common.User, error)

GetUser uses the specified common.Credentials to access the users profile from the remote provider, and builds the appropriate User object.

func (*GitlabProvider) Name

func (provider *GitlabProvider) Name() string

Name is the unique name for this provider.

func (*GitlabProvider) PublicData

func (provider *GitlabProvider) PublicData(options map[string]interface{}) (interface{}, error)

PublicData gets a public readable view of this provider.

func (*GitlabProvider) TripperFactory

func (provider *GitlabProvider) TripperFactory() common.TripperFactory

TripperFactory gets an OAuth2TripperFactory

type User

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

func NewUser

func NewUser(data objx.Map, creds *common.Credentials, provider common.Provider) *User

NewUser builds a new User object for Github.

func (*User) AuthCode

func (u *User) AuthCode() string

AuthCode gets this user's globally unique ID (generated by the host program)

func (*User) AvatarURL

func (u *User) AvatarURL() string

AvatarURL gets the URL of an image representing the user.

func (*User) Data

func (u *User) Data() objx.Map

GetValue gets any User field by name.

func (*User) Email

func (u *User) Email() string

Email gets the users email address.

func (*User) IDForProvider

func (u *User) IDForProvider(provider string) string

IDForProvider gets the ID value for the specified provider name for this user from the ProviderCredentials data.

func (*User) Name

func (u *User) Name() string

Name gets the users full name.

func (*User) Nickname

func (u *User) Nickname() string

Nickname gets the users nickname or username.

func (*User) ProviderCredentials

func (u *User) ProviderCredentials() map[string]*common.Credentials

ProviderCredentials gets a map of Credentials (by provider name).

func (*User) PublicData

func (u *User) PublicData(options map[string]interface{}) (publicData interface{}, err error)

Jump to

Keyboard shortcuts

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