cas

package
v0.0.0-...-bdbfde4 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2016 License: ISC Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEBUG
	INFO
	WARN
)

Variables

View Source
var (
	// Input errors (error codes 100-199)
	InvalidEmailAddressError = CASServerError{
		Msg:          "An error occurred finding a user with that email address.. Please wait a while and try again",
		HttpCode:     http.StatusInternalServerError,
		CasgoErrCode: 100,
	}
	InvalidCredentialsError = CASServerError{
		Msg:          "Invalid email/password combination",
		HttpCode:     http.StatusUnauthorized,
		CasgoErrCode: 101,
	}
	FailedToFindServiceError = CASServerError{
		Msg:          "Failed to find matching service",
		HttpCode:     http.StatusNotImplemented,
		CasgoErrCode: 102,
	}
	FailedToFindTicketError = CASServerError{
		Msg:          "Failed to find matching ticket",
		HttpCode:     http.StatusBadRequest,
		CasgoErrCode: 103,
	}
	SSOAuthenticatedUserRenewError = CASServerError{
		Msg:          "Failed to validate ticket, renew option specified and user was SSO authenticated",
		HttpCode:     http.StatusNotImplemented,
		CasgoErrCode: 103,
	}
	EmailAlreadyTakenError = CASServerError{
		Msg:          "Looks like that email address is already taken. If you've forgotten your password, please contact the administrator",
		HttpCode:     http.StatusBadRequest,
		CasgoErrCode: 104,
	}
	FailedToFindUserError = CASServerError{
		Msg:          "Failed to find matching email/password combination",
		HttpCode:     http.StatusBadRequest,
		CasgoErrCode: 105,
	}
	FailedToRetrieveServicesError = CASServerError{
		Msg:          "Failed to retrieve services for logged in user. Please ensure you are logged in.",
		HttpCode:     http.StatusBadRequest,
		CasgoErrCode: 106,
	}
	ServiceNameAlreadyTakenError = CASServerError{
		Msg:          "Looks like that service name is already taken. Please use a different service name.",
		HttpCode:     http.StatusBadRequest,
		CasgoErrCode: 107,
	}
	InvalidServiceNameError = CASServerError{
		Msg:          "Invalid service name provided.",
		HttpCode:     http.StatusBadRequest,
		CasgoErrCode: 108,
	}
	FailedToAuthenticateUserError = CASServerError{
		Msg:          "Failed to authenticate API user. Please ensure that you have provided sufficient credentials (whether through relevant headers or session information)..",
		HttpCode:     http.StatusUnauthorized,
		CasgoErrCode: 109,
	}
	FailedToFindUserByApiKeyAndSecretError = CASServerError{
		Msg:          "Failed to find user with given API credentials. Please ensure credentials are valid and try again.",
		HttpCode:     http.StatusUnauthorized,
		CasgoErrCode: 110,
	}
	InsufficientPermissionsError = CASServerError{
		Msg:          "Authenticated user has insufficient permissions to perform this action.",
		HttpCode:     http.StatusForbidden,
		CasgoErrCode: 111,
	}
	InvalidServiceError = CASServerError{
		Msg:          "Incomplete/Invalid service object provided. Please ensure all appropriate service fields are filled and re-submit.",
		HttpCode:     http.StatusForbidden,
		CasgoErrCode: 112,
	}
	FailedToParseJSONError = CASServerError{
		Msg:          "Incomplete/Invalid JSON. Please ensure request body is properly formatted and retry.",
		HttpCode:     http.StatusBadRequest,
		CasgoErrCode: 113,
	}
	InvalidUserError = CASServerError{
		Msg:          "Incomplete/Invalid user object provided. Please ensure all appropriate user fields are filled and re-submit.",
		HttpCode:     http.StatusForbidden,
		CasgoErrCode: 114,
	}
	InvalidUserEmailError = CASServerError{
		Msg:          "Invalid user email provided.",
		HttpCode:     http.StatusBadRequest,
		CasgoErrCode: 115,
	}

	// Internal Server errors (error codes 200 - 299)
	FailedToSaveSessionError = CASServerError{
		Msg:          "Failed to save session",
		HttpCode:     http.StatusInternalServerError,
		CasgoErrCode: 200,
	}
	FailedToDeleteSessionError = CASServerError{
		Msg:          "Failed to delete session",
		HttpCode:     http.StatusInternalServerError,
		CasgoErrCode: 201,
	}
	FailedToCreateNewAuthTicketError = CASServerError{
		Msg:          "Failed to create new authentication ticket",
		HttpCode:     http.StatusInternalServerError,
		CasgoErrCode: 202,
	}
	AuthMethodNotSupportedError = CASServerError{
		Msg:          "Failed to create new authentication ticket",
		HttpCode:     http.StatusMethodNotAllowed,
		CasgoErrCode: 203,
	}
	FailedToCreateUserError = CASServerError{
		Msg:          "An error occurred while creating your account.. Please verify fields and try again",
		HttpCode:     http.StatusInternalServerError,
		CasgoErrCode: 204,
	}
	FailedToTeardownDatabaseError = CASServerError{
		Msg:          "Failed to tear down database",
		HttpCode:     http.StatusInternalServerError,
		CasgoErrCode: 205,
	}
	FailedToSetupDatabaseError = CASServerError{
		Msg:          "Failed to setup database",
		HttpCode:     http.StatusInternalServerError,
		CasgoErrCode: 206,
	}
	FailedToLoadJSONFixtureError = CASServerError{
		Msg:          "Failed to import database information from file",
		HttpCode:     http.StatusInternalServerError,
		CasgoErrCode: 207,
	}
	FailedToLookupServiceByUrlError = CASServerError{
		Msg:          "An error occurred while searching for service with given URL",
		HttpCode:     http.StatusInternalServerError,
		CasgoErrCode: 208,
	}
	FailedToCreateTicketError = CASServerError{
		Msg:          "Failed to create ticket",
		HttpCode:     http.StatusInternalServerError,
		CasgoErrCode: 209,
	}
	FailedToDeleteTicketsForUserError = CASServerError{
		Msg:          "Failed to delete tickets for user",
		HttpCode:     http.StatusInternalServerError,
		CasgoErrCode: 210,
	}
	FailedToSetupTableError = CASServerError{
		Msg:          "Failed to setup table",
		HttpCode:     http.StatusInternalServerError,
		CasgoErrCode: 211,
	}
	FailedToCreateTableError = CASServerError{
		Msg:          "Failed to setup database",
		HttpCode:     http.StatusInternalServerError,
		CasgoErrCode: 212,
	}
	DbExistsCheckFailedError = CASServerError{
		Msg:          "Failed to check whether database existed",
		HttpCode:     http.StatusInternalServerError,
		CasgoErrCode: 213,
	}
	FailedToFindServiceByUrlError = CASServerError{
		Msg:          "Failed to find service with given URL",
		HttpCode:     http.StatusInternalServerError,
		CasgoErrCode: 214,
	}
	FailedToFindUserByEmailError = CASServerError{
		Msg:          "Failed to find user with given email address",
		HttpCode:     http.StatusInternalServerError,
		CasgoErrCode: 215,
	}
	FailedToRetrieveInformationFromSessionError = CASServerError{
		Msg:          "Failed to retrieve information from session",
		HttpCode:     http.StatusInternalServerError,
		CasgoErrCode: 216,
	}
	FailedToCreateServiceError = CASServerError{
		Msg:          "An error occurred while creating the service... Please verify fields and try again",
		HttpCode:     http.StatusInternalServerError,
		CasgoErrCode: 217,
	}
	FailedToDeleteServiceError = CASServerError{
		Msg:          "Failed to delete service.",
		HttpCode:     http.StatusInternalServerError,
		CasgoErrCode: 218,
	}
	FailedToListServicesError = CASServerError{
		Msg:          "Failed to list services.",
		HttpCode:     http.StatusInternalServerError,
		CasgoErrCode: 219,
	}
	FailedToUpdateServiceError = CASServerError{
		Msg:          "Failed to update service.",
		HttpCode:     http.StatusInternalServerError,
		CasgoErrCode: 220,
	}
	FailedToListUsersError = CASServerError{
		Msg:          "Failed to list users.",
		HttpCode:     http.StatusInternalServerError,
		CasgoErrCode: 221,
	}
	FailedToDeleteUserError = CASServerError{
		Msg:          "Failed to delete user.",
		HttpCode:     http.StatusInternalServerError,
		CasgoErrCode: 222,
	}
	FailedToUpdateUserError = CASServerError{
		Msg:          "Failed to update user.",
		HttpCode:     http.StatusInternalServerError,
		CasgoErrCode: 220,
	}

	// Other (error codes 300 - 399)
	UnsupportedFeatureError = CASServerError{
		Msg:          "Feature not supported by CASGO",
		HttpCode:     http.StatusNotImplemented,
		CasgoErrCode: 300,
	}
)

Error declarations

View Source
var CONFIG_DEFAULTS map[string]string = map[string]string{
	"host":               "0.0.0.0",
	"port":               "9090",
	"dbHost":             "localhost:28015",
	"dbName":             "casgo",
	"cookieSecret":       "secret-casgo-secret",
	"templatesDirectory": "templates/",
	"companyName":        "companyABC",
	"authMethod":         "password",
	"logLevel":           "WARN",
	"tlsCertFile":        "fixtures/ssl/cert.pem",
	"tlsKeyFile":         "fixtures/ssl/eckey.pem",
}
View Source
var CONFIG_ENV_OVERRIDE_MAP map[string]string = map[string]string{
	"host":               "CASGO_HOST",
	"port":               "CASGO_PORT",
	"dbHost":             "CASGO_DBHOST",
	"dbName":             "CASGO_DBNAME",
	"cookieSecret":       "CASGO_SECRET",
	"templatesDirectory": "CASGO_TEMPLATES",
	"companyName":        "CASGO_COMPNAME",
	"authMethod":         "CASGO_DEFAULT_AUTH",
	"logLevel":           "CASGO_LOG_LVL",
	"tlsCertFile":        "CASGO_TLS_CERT",
	"tlsKeyFile":         "CASGO_TLS_KEY",
}

Functions

func CompareTickets

func CompareTickets(a, b CASTicket) bool

Compairson function for CASTickets

func ListFilesInBox

func ListFilesInBox(box *rice.Box, prefix string) ([]string, error)

func NewCASServerConfig

func NewCASServerConfig(configFilePath string) (map[string]string, error)

Create default casgo configuration, with user overrides if any

Types

type CAS

type CAS struct {
	ServeMux *mux.Router
	Config   map[string]string
	Db       CASDBAdapter
	Api      CasgoFrontendAPI

	LogLevel int
	// contains filtered or unexported fields
}

CAS Server

func NewCASServer

func NewCASServer(config map[string]string) (*CAS, error)

func (*CAS) GetAddr

func (c *CAS) GetAddr() string

Get the address of the server based on server configuration

func (*CAS) HandleIndex

func (c *CAS) HandleIndex(w http.ResponseWriter, req *http.Request)

(Optional) Handles Index route

func (*CAS) HandleLogin

func (c *CAS) HandleLogin(w http.ResponseWriter, req *http.Request)

Handle logins (functions as both a credential acceptor and requestor)

func (*CAS) HandleLogout

func (c *CAS) HandleLogout(w http.ResponseWriter, req *http.Request)

Endpoint for destroying CAS sessions (logging out)

func (*CAS) HandleProxy

func (c *CAS) HandleProxy(w http.ResponseWriter, req *http.Request)

Endpoint for handling proxy tickets (CAS 2.0)

func (*CAS) HandleProxyValidate

func (c *CAS) HandleProxyValidate(w http.ResponseWriter, req *http.Request)

Endpoint for validating proxy tickets (CAS 2.0)

func (*CAS) HandleRegister

func (c *CAS) HandleRegister(w http.ResponseWriter, req *http.Request)

Endpoint for registering new users

func (*CAS) HandleServiceValidate

func (c *CAS) HandleServiceValidate(w http.ResponseWriter, req *http.Request)

Endpoint for validating service tickets for possible proxies (CAS 2.0)

func (*CAS) HandleValidate

func (c *CAS) HandleValidate(w http.ResponseWriter, req *http.Request)

Endpoint for validating service tickets

func (*CAS) SetupDb

func (c *CAS) SetupDb() *CASServerError

Set up the underlying database

func (*CAS) Start

func (c *CAS) Start()

Start the CAS server

func (*CAS) TeardownDb

func (c *CAS) TeardownDb() *CASServerError

Teardown the underlying database

type CASDBAdapter

type CASDBAdapter interface {
	// Database setup & teardown logic
	Setup() *CASServerError
	Teardown() *CASServerError

	// Table setup & teardown logic
	DbExists() (bool, *CASServerError)
	SetupTable(string) *CASServerError
	TeardownTable(string) *CASServerError
	SetupServicesTable() *CASServerError
	TeardownServicesTable() *CASServerError
	SetupUsersTable() *CASServerError
	TeardownUsersTable() *CASServerError
	SetupTicketsTable() *CASServerError
	TeardownTicketsTable() *CASServerError

	// Fixture loading utility function
	LoadJSONFixture(string, string, string) *CASServerError

	// App functions
	FindServiceByUrl(string) (*CASService, *CASServerError)
	FindUserByEmail(string) (*User, *CASServerError)
	FindUserByApiKeyAndSecret(string, string) (*User, *CASServerError)
	AddTicketForService(ticket *CASTicket, service *CASService) (*CASTicket, *CASServerError)
	RemoveTicketsForUserWithService(string, *CASService) *CASServerError
	FindTicketByIdForService(string, *CASService) (*CASTicket, *CASServerError)
	AddNewUser(string, string) (*User, *CASServerError)

	// REST API functions (CRUD)
	GetAllUsers() ([]User, *CASServerError)
	UpdateUser(*User) *CASServerError
	RemoveUserByEmail(string) *CASServerError

	GetAllServices() ([]CASService, *CASServerError)
	AddNewService(*CASService) *CASServerError
	RemoveServiceByName(string) *CASServerError
	UpdateService(*CASService) *CASServerError

	// Property getter utility functions
	GetDbName() string
	GetTicketsTableName() string
	GetServicesTableName() string
	GetUsersTableName() string
	GetApiKeysTableName() string
}

CAS DB interface

type CASServer

type CASServer interface {
	HandleLogin(w http.ResponseWriter, r *http.Request)
	HandleLogout(w http.ResponseWriter, r *http.Request)
	HandleRegister(w http.ResponseWriter, r *http.Request)
	HandleValidate(w http.ResponseWriter, r *http.Request)
	HandleServiceValidate(w http.ResponseWriter, r *http.Request)
	HandleProxyValidate(w http.ResponseWriter, r *http.Request)
	HandleProxy(w http.ResponseWriter, r *http.Request)
}

CAS server interface

type CASServerError

type CASServerError struct {
	Msg          string // Message string
	HttpCode     int    // HTTP error code, if applicable
	CasgoErrCode int    // CASGO specific error code
	// contains filtered or unexported fields
}

func (*CASServerError) Error

func (err *CASServerError) Error() string

type CASService

type CASService struct {
	Url        string `gorethink:"url" json:"url"`
	Name       string `gorethink:"name" json:"name"`
	AdminEmail string `gorethink:"adminEmail" json:"adminEmail"`
}

CasGo registered service

func (*CASService) IsValid

func (s *CASService) IsValid() bool

Enforce schema for CASService

func (*CASService) IsValidUpdate

func (s *CASService) IsValidUpdate() bool

Enforce lax schema for CASService updates (as they may not include some otherwise required fields) at least the name must be present (used when getting the service, as it is the PK)

type CASTicket

type CASTicket struct {
	Id             string            `gorethink:"id,omitempty" json:"id"`
	UserEmail      string            `gorethink:"userEmail" json:"userEmail"`
	UserAttributes map[string]string `gorethink:"userAttributes" json:"userAttributes"`
	WasSSO         bool              `gorethink:"wasSSO" json:"wasSSO"`
}

CasGo ticket

type CasgoAPIKeyPair

type CasgoAPIKeyPair struct {
	Key    string `gorethink:"key" json:"key"`
	Secret string `gorethink:"secret" json:"secret"`
	User   *User  `gorethink:"user" json:"user"`
}

CasGo API keypair

type CasgoFrontendAPI

type CasgoFrontendAPI interface {
	HookupAPIEndpoints(*mux.Router)

	// Services Endpoint
	GetServices(http.ResponseWriter, *http.Request)
	RemoveService(http.ResponseWriter, *http.Request)
	CreateService(http.ResponseWriter, *http.Request)

	SessionsHandler(http.ResponseWriter, *http.Request)
	// contains filtered or unexported methods
}

type FrontendAPI

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

CasGo frontend RESTful API

func NewCasgoFrontendAPI

func NewCasgoFrontendAPI(c *CAS) (*FrontendAPI, error)

func (*FrontendAPI) CreateService

func (api *FrontendAPI) CreateService(w http.ResponseWriter, req *http.Request)

Create a new service

func (*FrontendAPI) CreateUser

func (api *FrontendAPI) CreateUser(w http.ResponseWriter, req *http.Request)

Create a new user

func (*FrontendAPI) GetServices

func (api *FrontendAPI) GetServices(w http.ResponseWriter, req *http.Request)

Get list of services (admin only)

func (*FrontendAPI) GetUsers

func (api *FrontendAPI) GetUsers(w http.ResponseWriter, req *http.Request)

Get list of users (admin only)

func (*FrontendAPI) HookupAPIEndpoints

func (api *FrontendAPI) HookupAPIEndpoints(m *mux.Router)

Hook up API endpoints to given mux

func (*FrontendAPI) RemoveService

func (api *FrontendAPI) RemoveService(w http.ResponseWriter, req *http.Request)

Remove a service Returns the removed service's name

func (*FrontendAPI) RemoveUser

func (api *FrontendAPI) RemoveUser(w http.ResponseWriter, req *http.Request)

Remove a user Returns the removed user's email

func (*FrontendAPI) SessionsHandler

func (api *FrontendAPI) SessionsHandler(w http.ResponseWriter, req *http.Request)

Handle sessions endpoint

func (*FrontendAPI) UpdateService

func (api *FrontendAPI) UpdateService(w http.ResponseWriter, req *http.Request)

Update an existing service Returns the modified service

func (*FrontendAPI) UpdateUser

func (api *FrontendAPI) UpdateUser(w http.ResponseWriter, req *http.Request)

Update an existing user Returns the modified user

func (*FrontendAPI) WrapAdminOnlyEndpoint

func (api *FrontendAPI) WrapAdminOnlyEndpoint(handler func(http.ResponseWriter, *http.Request)) func(http.ResponseWriter, *http.Request)

Middleware for routes that require admin access

type RethinkDBAdapter

type RethinkDBAdapter struct {
	LogLevel string
	// contains filtered or unexported fields
}

RethinkDB Adapter

func NewRethinkDBAdapter

func NewRethinkDBAdapter(c *CAS) (*RethinkDBAdapter, error)

func (*RethinkDBAdapter) AddNewService

func (db *RethinkDBAdapter) AddNewService(service *CASService) *CASServerError

func (*RethinkDBAdapter) AddNewUser

func (db *RethinkDBAdapter) AddNewUser(username, password string) (*User, *CASServerError)

Add a new user to the database

func (*RethinkDBAdapter) AddTicketForService

func (db *RethinkDBAdapter) AddTicketForService(ticket *CASTicket, service *CASService) (*CASTicket, *CASServerError)

Add new CASTicket to the database for the given service

func (*RethinkDBAdapter) DbExists

func (db *RethinkDBAdapter) DbExists() (bool, *CASServerError)

Check if the database has been setup

func (*RethinkDBAdapter) FindServiceByUrl

func (db *RethinkDBAdapter) FindServiceByUrl(serviceUrl string) (*CASService, *CASServerError)

Find a service by given URL (callback URL)

func (*RethinkDBAdapter) FindTicketByIdForService

func (db *RethinkDBAdapter) FindTicketByIdForService(ticketId string, service *CASService) (*CASTicket, *CASServerError)

Find ticket by Id for a given service

func (*RethinkDBAdapter) FindUserByApiKeyAndSecret

func (db *RethinkDBAdapter) FindUserByApiKeyAndSecret(key, secret string) (*User, *CASServerError)

Find a user by API secret and key

func (*RethinkDBAdapter) FindUserByEmail

func (db *RethinkDBAdapter) FindUserByEmail(email string) (*User, *CASServerError)

Find a user by email address ("username")

func (*RethinkDBAdapter) GetAllServices

func (db *RethinkDBAdapter) GetAllServices() ([]CASService, *CASServerError)

Get all services

func (*RethinkDBAdapter) GetAllUsers

func (db *RethinkDBAdapter) GetAllUsers() ([]User, *CASServerError)

Get all users

func (*RethinkDBAdapter) GetApiKeysTableName

func (db *RethinkDBAdapter) GetApiKeysTableName() string

func (*RethinkDBAdapter) GetDbName

func (db *RethinkDBAdapter) GetDbName() string

func (*RethinkDBAdapter) GetServicesTableName

func (db *RethinkDBAdapter) GetServicesTableName() string

func (*RethinkDBAdapter) GetTicketsTableName

func (db *RethinkDBAdapter) GetTicketsTableName() string

func (*RethinkDBAdapter) GetUsersTableName

func (db *RethinkDBAdapter) GetUsersTableName() string

func (*RethinkDBAdapter) LoadJSONFixture

func (db *RethinkDBAdapter) LoadJSONFixture(dbName, tableName, path string) *CASServerError

Load database fixture, given intended database name, table and path to fixture file (JSON)

func (*RethinkDBAdapter) RemoveServiceByName

func (db *RethinkDBAdapter) RemoveServiceByName(name string) *CASServerError

Remove a service by name (pkey)

func (*RethinkDBAdapter) RemoveTicketsForUserWithService

func (db *RethinkDBAdapter) RemoveTicketsForUserWithService(email string, service *CASService) *CASServerError

Remove tickets for a given user under a given service

func (*RethinkDBAdapter) RemoveUserByEmail

func (db *RethinkDBAdapter) RemoveUserByEmail(email string) *CASServerError

Remove a user by email (pkey)

func (*RethinkDBAdapter) Setup

func (db *RethinkDBAdapter) Setup() *CASServerError

Create/Setup all relevant tables in the database

func (*RethinkDBAdapter) SetupApiKeysTable

func (db *RethinkDBAdapter) SetupApiKeysTable() *CASServerError

Set up the table that holds apikeys

func (*RethinkDBAdapter) SetupServicesTable

func (db *RethinkDBAdapter) SetupServicesTable() *CASServerError

Set up the table that holds services

func (*RethinkDBAdapter) SetupTable

func (db *RethinkDBAdapter) SetupTable(tableName string) *CASServerError

Dynamically setup tables - dispatch because each table might have special implementations

func (*RethinkDBAdapter) SetupTicketsTable

func (db *RethinkDBAdapter) SetupTicketsTable() *CASServerError

Set up the table that holds tickets

func (*RethinkDBAdapter) SetupUsersTable

func (db *RethinkDBAdapter) SetupUsersTable() *CASServerError

Set up the table that holds users

func (*RethinkDBAdapter) Teardown

func (db *RethinkDBAdapter) Teardown() *CASServerError

Clear all relevant databases and/or tables

func (*RethinkDBAdapter) TeardownApiKeysTable

func (db *RethinkDBAdapter) TeardownApiKeysTable() *CASServerError

Tear down the table that holds apikeys

func (*RethinkDBAdapter) TeardownServicesTable

func (db *RethinkDBAdapter) TeardownServicesTable() *CASServerError

Tear down the table that holds services

func (*RethinkDBAdapter) TeardownTable

func (db *RethinkDBAdapter) TeardownTable(tableName string) *CASServerError

Dynamically teardown tables - dispatch because each table might have special implementations

func (*RethinkDBAdapter) TeardownTicketsTable

func (db *RethinkDBAdapter) TeardownTicketsTable() *CASServerError

Tear down the table that holds tickets

func (*RethinkDBAdapter) TeardownUsersTable

func (db *RethinkDBAdapter) TeardownUsersTable() *CASServerError

Tear down the table that holds users

func (*RethinkDBAdapter) UpdateService

func (db *RethinkDBAdapter) UpdateService(service *CASService) *CASServerError

Update service with a similar name to the passed in service (key)

func (*RethinkDBAdapter) UpdateUser

func (db *RethinkDBAdapter) UpdateUser(user *User) *CASServerError

Update user with a similar name to the passed in user (key)

type StringTuple

type StringTuple [2]string

Small string tuple class implementation (see util.go)

func (*StringTuple) First

func (t *StringTuple) First() string

Small tuple implementation

func (*StringTuple) Second

func (t *StringTuple) Second() string

Small tuple implementation

type User

type User struct {
	Email      string            `gorethink:"email" json:"email"`
	Attributes map[string]string `gorethink:"attributes" json:"attributes"`
	Password   string            `gorethink:"password" json:"password"`
	Services   []CASService      `gorethink:"services" json:"services"`
	IsAdmin    bool              `gorethink:"isAdmin" json:"isAdmin"`
}

CasGo user

func (*User) IsValid

func (u *User) IsValid() bool

Enforce schema for Users

func (*User) IsValidUpdate

func (u *User) IsValidUpdate() bool

Enforce lax schema for user updates (as they may not include Password field) at least the email must be present (used when getting the user, as it is the PK)

Directories

Path Synopsis
Godeps
_workspace/src/github.com/GeertJohan/go.rice/embedded
Package embedded defines embedded data types that are shared between the go.rice package and generated code.
Package embedded defines embedded data types that are shared between the go.rice package and generated code.
_workspace/src/github.com/Sirupsen/logrus
Package logrus is a structured logger for Go, completely API compatible with the standard library logger.
Package logrus is a structured logger for Go, completely API compatible with the standard library logger.
_workspace/src/github.com/cenkalti/backoff
Package backoff implements backoff algorithms for retrying operations.
Package backoff implements backoff algorithms for retrying operations.
_workspace/src/github.com/daaku/go.zipexe
Package zipexe attempts to open an executable binary file as a zip file.
Package zipexe attempts to open an executable binary file as a zip file.
_workspace/src/github.com/dancannon/gorethink
Package gorethink implements a Go driver for RethinkDB Current version: v1.1.4 (RethinkDB v2.1) For more in depth information on how to use RethinkDB check out the API docs at http://rethinkdb.com/api
Package gorethink implements a Go driver for RethinkDB Current version: v1.1.4 (RethinkDB v2.1) For more in depth information on how to use RethinkDB check out the API docs at http://rethinkdb.com/api
_workspace/src/github.com/dancannon/gorethink/ql2
Package ql2 is a generated protocol buffer package.
Package ql2 is a generated protocol buffer package.
_workspace/src/github.com/golang/protobuf/proto
Package proto converts data structures to and from the wire format of protocol buffers.
Package proto converts data structures to and from the wire format of protocol buffers.
_workspace/src/github.com/golang/protobuf/proto/proto3_proto
Package proto3_proto is a generated protocol buffer package.
Package proto3_proto is a generated protocol buffer package.
_workspace/src/github.com/gorilla/context
Package context stores values shared during a request lifetime.
Package context stores values shared during a request lifetime.
_workspace/src/github.com/gorilla/mux
Package gorilla/mux implements a request router and dispatcher.
Package gorilla/mux implements a request router and dispatcher.
_workspace/src/github.com/gorilla/securecookie
Package gorilla/securecookie encodes and decodes authenticated and optionally encrypted cookie values.
Package gorilla/securecookie encodes and decodes authenticated and optionally encrypted cookie values.
_workspace/src/github.com/gorilla/sessions
Package gorilla/sessions provides cookie and filesystem sessions and infrastructure for custom session backends.
Package gorilla/sessions provides cookie and filesystem sessions and infrastructure for custom session backends.
_workspace/src/github.com/kardianos/osext
Extensions to the standard "os" package.
Extensions to the standard "os" package.
_workspace/src/github.com/unrolled/render
Package render is a package that provides functionality for easily rendering JSON, XML, binary data, and HTML templates.
Package render is a package that provides functionality for easily rendering JSON, XML, binary data, and HTML templates.
_workspace/src/golang.org/x/crypto/bcrypt
Package bcrypt implements Provos and Mazières's bcrypt adaptive hashing algorithm.
Package bcrypt implements Provos and Mazières's bcrypt adaptive hashing algorithm.
_workspace/src/golang.org/x/crypto/blowfish
Package blowfish implements Bruce Schneier's Blowfish encryption algorithm.
Package blowfish implements Bruce Schneier's Blowfish encryption algorithm.
integration_test
Godeps/_workspace/src/code.google.com/p/go.crypto/bcrypt
Package bcrypt implements Provos and Mazières's bcrypt adaptive hashing algorithm.
Package bcrypt implements Provos and Mazières's bcrypt adaptive hashing algorithm.
Godeps/_workspace/src/github.com/GeertJohan/go.rice/embedded
Package embedded defines embedded data types that are shared between the go.rice package and generated code.
Package embedded defines embedded data types that are shared between the go.rice package and generated code.
Godeps/_workspace/src/github.com/cenkalti/backoff
Package backoff implements backoff algorithms for retrying operations.
Package backoff implements backoff algorithms for retrying operations.
Godeps/_workspace/src/github.com/daaku/go.zipexe
Package zipexe attempts to open an executable binary file as a zip file.
Package zipexe attempts to open an executable binary file as a zip file.
Godeps/_workspace/src/github.com/dancannon/gorethink
Package gorethink implements a Go driver for RethinkDB Current version: v0.7.1 (RethinkDB v2.0) For more in depth information on how to use RethinkDB check out the API docs at http://rethinkdb.com/api
Package gorethink implements a Go driver for RethinkDB Current version: v0.7.1 (RethinkDB v2.0) For more in depth information on how to use RethinkDB check out the API docs at http://rethinkdb.com/api
Godeps/_workspace/src/github.com/golang/protobuf/proto
Package proto converts data structures to and from the wire format of protocol buffers.
Package proto converts data structures to and from the wire format of protocol buffers.
Godeps/_workspace/src/github.com/gorilla/context
Package gorilla/context stores values shared during a request lifetime.
Package gorilla/context stores values shared during a request lifetime.
Godeps/_workspace/src/github.com/gorilla/mux
Package gorilla/mux implements a request router and dispatcher.
Package gorilla/mux implements a request router and dispatcher.
Godeps/_workspace/src/github.com/gorilla/securecookie
Package gorilla/securecookie encodes and decodes authenticated and optionally encrypted cookie values.
Package gorilla/securecookie encodes and decodes authenticated and optionally encrypted cookie values.
Godeps/_workspace/src/github.com/gorilla/sessions
Package gorilla/sessions provides cookie and filesystem sessions and infrastructure for custom session backends.
Package gorilla/sessions provides cookie and filesystem sessions and infrastructure for custom session backends.
Godeps/_workspace/src/github.com/kardianos/osext
Extensions to the standard "os" package.
Extensions to the standard "os" package.
Godeps/_workspace/src/github.com/onsi/ginkgo
Ginkgo is a BDD-style testing framework for Golang The godoc documentation describes Ginkgo's API.
Ginkgo is a BDD-style testing framework for Golang The godoc documentation describes Ginkgo's API.
Godeps/_workspace/src/github.com/onsi/ginkgo/config
Ginkgo accepts a number of configuration options.
Ginkgo accepts a number of configuration options.
Godeps/_workspace/src/github.com/onsi/ginkgo/ginkgo
The Ginkgo CLI The Ginkgo CLI is fully documented [here](http://onsi.github.io/ginkgo/#the_ginkgo_cli) You can also learn more by running: ginkgo help Here are some of the more commonly used commands: To install: go install github.com/onsi/ginkgo/ginkgo To run tests: ginkgo To run tests in all subdirectories: ginkgo -r To run tests in particular packages: ginkgo <flags> /path/to/package /path/to/another/package To pass arguments/flags to your tests: ginkgo <flags> <packages> -- <pass-throughs> To run tests in parallel ginkgo -p this will automatically detect the optimal number of nodes to use.
The Ginkgo CLI The Ginkgo CLI is fully documented [here](http://onsi.github.io/ginkgo/#the_ginkgo_cli) You can also learn more by running: ginkgo help Here are some of the more commonly used commands: To install: go install github.com/onsi/ginkgo/ginkgo To run tests: ginkgo To run tests in all subdirectories: ginkgo -r To run tests in particular packages: ginkgo <flags> /path/to/package /path/to/another/package To pass arguments/flags to your tests: ginkgo <flags> <packages> -- <pass-throughs> To run tests in parallel ginkgo -p this will automatically detect the optimal number of nodes to use.
Godeps/_workspace/src/github.com/onsi/ginkgo/internal/remote
Aggregator is a reporter used by the Ginkgo CLI to aggregate and present parallel test output coherently as tests complete.
Aggregator is a reporter used by the Ginkgo CLI to aggregate and present parallel test output coherently as tests complete.
Godeps/_workspace/src/github.com/onsi/ginkgo/reporters
Ginkgo's Default Reporter A number of command line flags are available to tweak Ginkgo's default output.
Ginkgo's Default Reporter A number of command line flags are available to tweak Ginkgo's default output.
Godeps/_workspace/src/github.com/onsi/gomega
Gomega is the Ginkgo BDD-style testing framework's preferred matcher library.
Gomega is the Ginkgo BDD-style testing framework's preferred matcher library.
Godeps/_workspace/src/github.com/onsi/gomega/format
Gomega's format package pretty-prints objects.
Gomega's format package pretty-prints objects.
Godeps/_workspace/src/github.com/onsi/gomega/gbytes
Package gbytes provides a buffer that supports incrementally detecting input.
Package gbytes provides a buffer that supports incrementally detecting input.
Godeps/_workspace/src/github.com/onsi/gomega/gexec
Package gexec provides support for testing external processes.
Package gexec provides support for testing external processes.
Godeps/_workspace/src/github.com/onsi/gomega/ghttp
Package ghttp supports testing HTTP clients by providing a test server (simply a thin wrapper around httptest's server) that supports registering multiple handlers.
Package ghttp supports testing HTTP clients by providing a test server (simply a thin wrapper around httptest's server) that supports registering multiple handlers.
Godeps/_workspace/src/github.com/onsi/gomega/matchers
Gomega matchers This package implements the Gomega matchers and does not typically need to be imported.
Gomega matchers This package implements the Gomega matchers and does not typically need to be imported.
Godeps/_workspace/src/github.com/sclevine/agouti
Package agouti is a universal WebDriver client for Go.
Package agouti is a universal WebDriver client for Go.
Godeps/_workspace/src/github.com/sclevine/agouti/api
Package api provides a generic, low-level WebDriver API client for Go.
Package api provides a generic, low-level WebDriver API client for Go.
Godeps/_workspace/src/github.com/sclevine/agouti/matchers
Package matchers provides a set of Gomega-compatible matchers for use with the agouti package.
Package matchers provides a set of Gomega-compatible matchers for use with the agouti package.
Godeps/_workspace/src/github.com/unrolled/render
Package render is a package that provides functionality for easily rendering JSON, XML, binary data, and HTML templates.
Package render is a package that provides functionality for easily rendering JSON, XML, binary data, and HTML templates.
Godeps/_workspace/src/golang.org/x/crypto/blowfish
Package blowfish implements Bruce Schneier's Blowfish encryption algorithm.
Package blowfish implements Bruce Schneier's Blowfish encryption algorithm.

Jump to

Keyboard shortcuts

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