oauth

package
v0.9.32 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package oauth implements an authentication client to be used with OAuth2 authentication services.

The package uses two json documents to retrieve the credentials, with the file names: client.json and user.json. These documents must be found on the file system under the directory passed in with the credentialsDir argument.

The structure of the client credentials document:

{"client_id": "testclientid", "client_secret": "testsecret"}

The structure of the user credentials document:

{"application_username": "testusername", "application_password": "testpassword"}

The GetToken method ignores the expiration date and makes a new request to the OAuth2 service on every call, so storing the token, if necessary, is the responsibility of the calling code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OAuthClient

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

An OAuthClient implements authentication to an OAuth2 service.

func New

func New(credentialsDir, oauthUrl, permissionScopes string) *OAuthClient

Initializes a new OAuthClient.

func (*OAuthClient) GetToken

func (oc *OAuthClient) GetToken() (string, error)

Returns a new authentication token.

Jump to

Keyboard shortcuts

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