credentials

package
v0.0.0-...-7d41a23 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2019 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package credentials contains all code related to the credentials domain.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	TestCredentials(c Credentials) (bool, error)
	OpenConnection(c Credentials) error
}

Backend interface.

type Credentials

type Credentials interface {
	URL() string
	Username() string
	Password() string
}

Credentials object contains information on how to connect to a realm.

func NewCredentials

func NewCredentials(url, username, password string) Credentials

NewCredentials create a new credentials object.

type Driver

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

Driver is the entry point of the domain that expose methods.

func NewDriver

func NewDriver(storage Storage, backend Backend) Driver

NewDriver create a new domain driver with given driven implementations.

func (Driver) Get

func (d Driver) Get(url string, username string) (Credentials, error)

Get password for the couple URL / Username.

func (Driver) Remove

func (d Driver) Remove(url string, username string) error

Remove password for the couple URL / Username from backend storage.

func (Driver) Set

func (d Driver) Set(url string, username string, password string) error

Set password for the couple URL / Username and store it securely.

func (Driver) Test

func (d Driver) Test(creds Credentials) (bool, error)

Test credentials (URL / Username / Password) against the backend.

func (Driver) Use

func (d Driver) Use(creds Credentials) error

Use method tell the backend to start using the credentials.

type Storage

type Storage interface {
	SetCredentials(c Credentials) error
	GetCredentials(url string, user string) (Credentials, error)
	RemoveCredentials(url string, username string) error
}

Storage interface for storing credentials.

Jump to

Keyboard shortcuts

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