cashew

package module
v0.0.0-...-01da6d2 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2019 License: MIT Imports: 5 Imported by: 0

README

cashew

cashew is a CAS server implementation

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticateUseCase

type AuthenticateUseCase interface {
	Authenticate(id, pass string) (map[string]interface{}, error)
}

AuthenticateUseCase interface for authenticate

type ClientHostNameRepository

type ClientHostNameRepository interface {
	Ensure(r *http.Request) string
}

ClientHostNameRepository is an interface to find real-ip/hostname

type Deliver

type Deliver interface {
	Mount()
}

Deliver delivery interface

type Executor

type Executor interface {
	Execute()
}

Executor is an interface as cli processor

type ExpirationRepository

type ExpirationRepository interface {
	FindAll() ([]*Ticket, error)
}

ExpirationRepository repository interface that find all expired items

type ExpirationUseCase

type ExpirationUseCase interface {
	RevokeAll() error
}

ExpirationUseCase interface for expiration check

type IDRepository

type IDRepository interface {
	Issue(t TicketType) string
}

IDRepository is an interface to issue an ID

type LogoutUseCase

type LogoutUseCase interface {
	Terminate(*Ticket) error
}

LogoutUseCase define behaviors for logout by tgt

type ProxyCallBackRepository

type ProxyCallBackRepository interface {
	Dial(u *url.URL, pgt, iou string) error
}

ProxyCallBackRepository is an interface to dial proxy-callback-url

type TerminateUseCase

type TerminateUseCase interface {
	Terminate(*Ticket) error
}

TerminateUseCase define behaviors for terminate ticket

type Ticket

type Ticket struct {
	// required fields
	ID             string
	Type           TicketType
	ClientHostName string
	CreatedAt      time.Time

	// required for service-ticket, proxy-ticket, proxy-granting-ticket and ticket-granting-ticket
	LastReferencedAt *time.Time

	// required for service ticket
	Service string

	// required for service ticket
	// that granted by proxy granting ticket and ticket granting ticket
	GrantedBy *Ticket

	// required for service or ticket granting ticket
	UserName string

	// required for proxy granting ticket
	IOU string

	// set true if this is service-ticket and primary
	Primary bool

	// required for ticket granting ticket, usually serialized json is set
	ExtraAttributes interface{}
}

Ticket struct for ticket

type TicketRepository

type TicketRepository interface {
	Find(id string) (*Ticket, error)
	Delete(*Ticket) error
	DeleteRelatedTicket(*Ticket) error
	Create(*Ticket) error
	Consume(*Ticket) error
}

TicketRepository repository for ticket

type TicketType

type TicketType int8

TicketType types of ticket

const (
	// TicketTypeService type of service ticket
	TicketTypeService TicketType = iota + 1
	// TicketTypeProxy type of proxy ticket
	TicketTypeProxy
	// TicketTypeTicketGranting type of ticket-granting ticket
	TicketTypeTicketGranting
	// TicketTypeProxyGranting type of proxy-granting ticket
	TicketTypeProxyGranting
	// TicketTypeProxyGrantingIOU type of proxy-granting ticket iou
	// TODO check is this really necessary
	TicketTypeProxyGrantingIOU
	// TicketTypeLogin type of login ticket
	TicketTypeLogin
)

func ParseTicketType

func ParseTicketType(s string) TicketType

ParseTicketType parse to ticket type from string

func (TicketType) Prefix

func (t TicketType) Prefix() string

Prefix return ticket-type prefix string

func (TicketType) String

func (t TicketType) String() string

String implements Stringer

type TicketUseCase

type TicketUseCase interface {
	Find(id string) (*Ticket, error)
	NewLogin(r *http.Request) (*Ticket, error)
	NewProxyGranting(r *http.Request, callbackURL *url.URL, st *Ticket) (*Ticket, error)
	NewService(r *http.Request, service *url.URL, tgt *Ticket, primary bool) (*Ticket, error)
	NewGranting(r *http.Request, username string, extraAttributes interface{}) (*Ticket, error)
	NewProxy(r *http.Request, service string, grantedBy *Ticket) (*Ticket, error)
	Consume(*Ticket) error
}

TicketUseCase define behaviors about finding and generating ticket

type ValidateUseCase

type ValidateUseCase interface {
	ValidateLogin(ticket *Ticket) error
	ValidateGranting(ticket *Ticket) error
	ValidateService(ticket *Ticket, service *url.URL, renew bool) error
	ValidateProxy(ticket *Ticket, service *url.URL) error
	ValidateProxyGranting(ticket *Ticket) error
}

ValidateUseCase define behaviors for validation

Directories

Path Synopsis
auth
cmd
deliver
executor
helpers
mocks
timer
Package timer is a generated GoMock package.
Package timer is a generated GoMock package.
provider
repository
id
usecase
validator
values

Jump to

Keyboard shortcuts

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