idmclient.v1: Index | Files

package ussologin

import ""

Package ussologin defines functionality used for allowing clients to authenticate with the IDM server using USSO OAuth.


Package Files

ussologin.go visitwebpage.go

func NewInteractor Uses

func NewInteractor(tg TokenGetter) httpbakery.Interactor

NewInteractor creates a new httpbakery.Interactor that interacts using the usso_oauth protocol.

func SetInteraction Uses

func SetInteraction(ierr *httpbakery.Error, url string)

SetInteraction sets the required values for the usso_oauth interaction method on an interaction required error.

type FileTokenStore Uses

type FileTokenStore struct {
    // contains filtered or unexported fields

FileTokenStore implements the TokenStore interface by storing the JSON-encoded oauth token in a file.

func NewFileTokenStore Uses

func NewFileTokenStore(path string) *FileTokenStore

NewFileTokenStore returns a new FileTokenStore that uses the given path for storage.

func (*FileTokenStore) Get Uses

func (f *FileTokenStore) Get() (*usso.SSOData, error)

Get implements TokenStore.Get by reading the token from the FileTokenStore's file.

func (*FileTokenStore) Put Uses

func (f *FileTokenStore) Put(tok *usso.SSOData) error

Put implements TokenStore.Put by writing the token to the FileTokenStore's file. If the file doesn't exist it will be created, including any required directories.

type FormTokenGetter Uses

type FormTokenGetter struct {
    Filler form.Filler
    Name   string

A FormTokenGetter is a TokenGetter implementation that presents a form to the user to get login details, and then uses those to get a token from Ubuntu SSO.

func (FormTokenGetter) GetToken Uses

func (g FormTokenGetter) GetToken(ctx context.Context) (*usso.SSOData, error)

GetToken uses filler to interact with the user and uses the provided information to obtain an OAuth token from Ubuntu SSO. The returned token can subsequently be used with LoginWithToken to perform a login. The tokenName argument is used as the name of the generated token in Ubuntu SSO. If Ubuntu SSO returned an error when trying to retrieve the token the error will have a cause of type *usso.Error.

type LoginResponse Uses

type LoginResponse struct {
    DischargeToken *httpbakery.DischargeToken `json:"discharge-token"`

A LoginResponse is a response from the login endpoint following a successful interaction.

type StoreTokenGetter Uses

type StoreTokenGetter struct {
    Store       TokenStore
    TokenGetter TokenGetter

A StoreTokenGetter is a TokenGetter that will try to retrieve the token from some storage, before falling back to another TokenGetter. If the fallback TokenGetter sucessfully retrieves a token then that token will be put in the store.

func (StoreTokenGetter) GetToken Uses

func (g StoreTokenGetter) GetToken(ctx context.Context) (*usso.SSOData, error)

GetToken implements TokenGetter.GetToken. A token is first attmepted to retireve from the store. If a stored token is not available then GetToken will fallback to TokenGetter.GetToken (if configured).

type TokenGetter Uses

type TokenGetter interface {
    GetToken(context.Context) (*usso.SSOData, error)

A TokenGetter is used to fetch a Ubuntu SSO OAuth token.

type TokenStore Uses

type TokenStore interface {
    // Put stores an Ubuntu SSO OAuth token.
    Put(tok *usso.SSOData) error
    // Get returns an Ubuntu SSO OAuth token from store
    Get() (*usso.SSOData, error)

TokenStore defines the interface for something that can store and returns oauth tokens.

Package ussologin imports 13 packages (graph) and is imported by 6 packages. Updated 2018-05-01. Refresh now. Tools for package owners.