connection

package
v0.0.0-...-be43ff6 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2015 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package connection offers account linking management capabilities

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection interface {
	// GetID returns the connection's unique identifier.
	GetID() string

	// GetProvider returns the connection's provider, for example "Google".
	GetProvider() string

	// GetLocalSubject returns the connection's local subject, for example "peter".
	GetLocalSubject() string

	// GetRemoteSubject returns the connection's remote subject, for example "peter@gmail.com".
	GetRemoteSubject() string
}

Connection connects an subject S with a token T issued by provider P

type DefaultConnection

type DefaultConnection struct {
	ID            string `json:"id,omitempty"`
	Provider      string `json:"provider" valid:"required"`
	LocalSubject  string `json:"localSubject" valid:"required"`
	RemoteSubject string `json:"remoteSubject" valid:"required"`
}

DefaultConnection is a default implementation of the Connection interface

func (*DefaultConnection) GetID

func (c *DefaultConnection) GetID() string

func (*DefaultConnection) GetLocalSubject

func (c *DefaultConnection) GetLocalSubject() string

func (*DefaultConnection) GetProvider

func (c *DefaultConnection) GetProvider() string

func (*DefaultConnection) GetRemoteSubject

func (c *DefaultConnection) GetRemoteSubject() string

type Storage

type Storage interface {
	// Create a new connection.
	Create(c Connection) error

	// Delete an existing connection.
	Delete(id string) error

	// Get an existing connection.
	Get(id string) (Connection, error)

	FindAllByLocalSubject(subject string) ([]Connection, error)

	FindByRemoteSubject(provider, subject string) (Connection, error)
}

Storage defines an interface for storing connections.

Directories

Path Synopsis
Package handler
Package handler
Package postgres uses PostgreSQL to implement connection.Storage
Package postgres uses PostgreSQL to implement connection.Storage

Jump to

Keyboard shortcuts

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