auth

package
v0.0.0-...-75db7dd Latest Latest
Warning

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

Go to latest
Published: May 22, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateSignature

func CalculateSignature(repoSecret []byte, payloadBody []byte) string

CalculateSignature calculates a signature based on a (repository's) secret.

func CompareSignatures

func CompareSignatures(x []byte, y []byte) bool

CompareSignatures does a constant time comparison of two signatures.

Types

type Method

type Method interface {
	RequestToken(repoFullName string) *oauth2.Token
	RequestSecret(repoFullName string) []byte
}

Method is a simple interface every authentication method has to implement. This might change in the future.

type Repository

type Repository struct {
	Token, Secret string
}

Repository is used to store tokens and secrets per repository. Tokens are used for downloading private repositories, setting statuses, etc. Secret are used to verify clients.

type SimpleAuth

type SimpleAuth struct {
	Store map[string]Repository
}

SimpleAuth is a map from strings representing repository names to its token and/or secret.

func (SimpleAuth) RequestSecret

func (auth SimpleAuth) RequestSecret(repoFullName string) []byte

RequestSecret returns the secret that belongs to a specific repository.

func (SimpleAuth) RequestToken

func (auth SimpleAuth) RequestToken(repoFullName string) *oauth2.Token

RequestToken the token that belongs to a specific repository.

Jump to

Keyboard shortcuts

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