controller

package
v0.0.0-...-2d73068 Latest Latest
Warning

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

Go to latest
Published: May 13, 2020 License: Apache-2.0 Imports: 38 Imported by: 3

Documentation

Index

Constants

View Source
const (
	DevUsername = "developer"
	DevEmail    = "osio-developer@email.com"
)

Variables

View Source
var (
	// Commit current build commit set by build script
	Commit = "0"
	// BuildTime set by build script in ISO 8601 (UTC) format: YYYY-MM-DDThh:mm:ssTZD (see https://www.w3.org/TR/NOTE-datetime for details)
	BuildTime = "0"
	// StartTime in ISO 8601 (UTC) format
	StartTime = time.Now().UTC().Format("2006-01-02T15:04:05Z")
)

Functions

func ConvertToAppUser

func ConvertToAppUser(request *goa.RequestData, user *accountrepo.User, identity *accountrepo.Identity, isAuthenticated bool) *app.User

ConvertToAppUser converts a complete Identity object into REST representation if isAuthenticated is set to True, then the 'email' field is populated irrespective of whether 'emailPrivate' = true/false. if isAuthenticated is set of False, then the 'email' field is populated only if 'emailPrivate' = false.

func ConvertUserSimple

func ConvertUserSimple(request *goa.RequestData, identityID interface{}) *app.GenericData

ConvertUserSimple converts a simple Identity ID into a Generic Reletionship

func ConvertUsersSimple

func ConvertUsersSimple(request *goa.RequestData, identityIDs []interface{}) []*app.GenericData

ConvertUsersSimple converts a array of simple Identity IDs into a Generic Reletionship List

Types

type AuthorizeController

type AuthorizeController struct {
	*goa.Controller
	// contains filtered or unexported fields
}

AuthorizeController implements the authorize resource.

func NewAuthorizeController

func NewAuthorizeController(service *goa.Service, app application.Application, config AuthorizeControllerConfiguration) *AuthorizeController

NewAuthorizeController returns a new AuthorizeController

func (*AuthorizeController) Authorize

Authorize runs the authorize action of /api/authorize endpoint.

func (*AuthorizeController) Callback

Callback takes care of Authorize callback

type AuthorizeControllerConfiguration

type AuthorizeControllerConfiguration interface {
	GetPublicOAuthClientID() string
}

type ClustersController

type ClustersController struct {
	*goa.Controller
	// contains filtered or unexported fields
}

ClustersController implements the clusters resource.

func NewClustersController

func NewClustersController(service *goa.Service, config clusterConfiguration) *ClustersController

NewClustersController creates a clusters controller.

func (*ClustersController) Show

Show runs the list of available OSO clusters.

type CollaboratorsController

type CollaboratorsController struct {
	*goa.Controller
	// contains filtered or unexported fields
}

CollaboratorsController implements the collaborators resource.

func NewCollaboratorsController

func NewCollaboratorsController(service *goa.Service, app application.Application, config collaboratorsConfiguration) *CollaboratorsController

NewCollaboratorsController creates a collaborators controller.

func (*CollaboratorsController) Add

Add user's identity to the list of space collaborators.

func (*CollaboratorsController) AddMany

AddMany adds user's identities to the list of space collaborators.

func (*CollaboratorsController) List

List collaborators for the given space ID.

func (*CollaboratorsController) Remove

Remove user from the list of space collaborators.

func (*CollaboratorsController) RemoveMany

RemoveMany removes users from the list of space collaborators.

type DBChecker

type DBChecker interface {
	Ping() error
}

DBChecker is to be used to check if the DB is reachable

func NewGormDBChecker

func NewGormDBChecker(db *gorm.DB) DBChecker

NewGormDBChecker constructs a new GormDBChecker

type GormDBChecker

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

GormDBChecker implements DB checker

func (*GormDBChecker) Ping

func (c *GormDBChecker) Ping() error

type InvitationController

type InvitationController struct {
	*goa.Controller
	// contains filtered or unexported fields
}

InvitationController implements the invitation resource.

func NewInvitationController

func NewInvitationController(service *goa.Service, app application.Application, configuration InvitationControllerConfiguration) *InvitationController

NewInvitationController creates a invitation controller.

func (*InvitationController) AcceptInvite

func (*InvitationController) CreateInvite

CreateInvite runs the create action.

func (*InvitationController) RescindInvite

RescindInvite runs the revoke action.

type InvitationControllerConfiguration

type InvitationControllerConfiguration interface {
	GetInvitationAcceptedRedirectURL() string
}

InvitationControllerConfiguration the Configuration for the InvitationController

type LoginController

type LoginController struct {
	*goa.Controller
	// contains filtered or unexported fields
}

LoginController implements the login resource.

func NewLoginController

func NewLoginController(service *goa.Service, app application.Application) *LoginController

NewLoginController creates a login controller.

func (*LoginController) Callback

func (c *LoginController) Callback(ctx *app.CallbackLoginContext) error

Callback implemnents the `GET /api/login/callback` endpoint

func (*LoginController) Login

func (c *LoginController) Login(ctx *app.LoginLoginContext) error

Login runs the login action.

type LogoutContext

type LogoutContext interface {
	context.Context
	TemporaryRedirect() error
	InternalServerError(*app.JSONAPIErrors) error
}

Common context interface for both logout endpoints

type LogoutController

type LogoutController struct {
	*goa.Controller
	// contains filtered or unexported fields
}

LogoutController implements the logout resource.

func NewLogoutController

func NewLogoutController(service *goa.Service, app application.Application) *LogoutController

NewLogoutController creates a logout controller.

func (*LogoutController) Logout

Logout runs the logout action.

func (*LogoutController) Logoutv2

func (c *LogoutController) Logoutv2(ctx *app.Logoutv2LogoutContext) error

Logoutv2 is a secured logout endpoint that also invalidates all of the user's tokens

type NamedusersController

type NamedusersController struct {
	*goa.Controller
	// contains filtered or unexported fields
}

NamedusersController implements the namedusers resource.

func NewNamedusersController

func NewNamedusersController(service *goa.Service, app application.Application, config UsersControllerConfiguration, tenantService appservice.TenantService) *NamedusersController

NewNamedusersController creates a namedusers controller.

func (*NamedusersController) Ban

Ban runs the "ban" action.

func (*NamedusersController) Deactivate

Deactivate runs the deactivate action.

func (*NamedusersController) Deprovision

Deprovision runs the deprovision action. DEPRECATED: see `Ban`

type OpenidConfigurationController

type OpenidConfigurationController struct {
	*goa.Controller
}

OpenidConfigurationController implements the openid_configuration resource.

func NewOpenidConfigurationController

func NewOpenidConfigurationController(service *goa.Service) *OpenidConfigurationController

NewOpenidConfigurationController creates a openid_configuration controller.

func (*OpenidConfigurationController) Show

Show runs the show action.

type OrganizationController

type OrganizationController struct {
	*goa.Controller
	// contains filtered or unexported fields
}

OrganizationController implements the organization resource.

func NewOrganizationController

func NewOrganizationController(service *goa.Service, app application.Application) *OrganizationController

NewOrganizationController creates an organization controller.

func (*OrganizationController) Create

Create runs the create action.

func (*OrganizationController) List

List runs the list action.

type ResourceController

type ResourceController struct {
	*goa.Controller

	TokenManager manager.TokenManager
	// contains filtered or unexported fields
}

ResourceController implements the resource resource.

func NewResourceController

func NewResourceController(service *goa.Service, app application.Application) *ResourceController

NewResourceController creates a resource controller.

func (*ResourceController) Delete

Delete runs the delete action.

func (*ResourceController) Register

Register runs the register action.

func (*ResourceController) Scopes

Scopes runs the scopes action, which returns the available scopes for the specified resource

func (*ResourceController) Show

Show runs the "Show" action.

type ResourceRolesController

type ResourceRolesController struct {
	*goa.Controller
	// contains filtered or unexported fields
}

ResourceRolesController implements the resource_roles resource.

func NewResourceRolesController

func NewResourceRolesController(service *goa.Service, app application.Application) *ResourceRolesController

NewResourceRolesController creates a resource_roles controller.

func (*ResourceRolesController) AssignRole

AssignRole assigns a specific role for a resource, to one or more identities.

func (*ResourceRolesController) HasScope

HasScope checks if the user has the given scope in the requested resource

func (*ResourceRolesController) ListAssigned

ListAssigned runs the list action.

func (*ResourceRolesController) ListAssignedByRoleName

ListAssignedByRoleName runs the list action.

type RolesController

type RolesController struct {
	*goa.Controller
	// contains filtered or unexported fields
}

RolesController implements the roles resource.

func NewRolesController

func NewRolesController(service *goa.Service, app application.Application) *RolesController

NewRolesController creates a roles controller.

func (*RolesController) List

func (c *RolesController) List(ctx *app.ListRolesContext) error

List runs the list action.

type SearchController

type SearchController struct {
	*goa.Controller
	// contains filtered or unexported fields
}

SearchController implements the search resource.

func NewSearchController

func NewSearchController(service *goa.Service, app application.Application, configuration searchConfiguration) *SearchController

NewSearchController creates a search controller.

func (*SearchController) Users

Users runs the user search action.

type SpaceController

type SpaceController struct {
	*goa.Controller
	// contains filtered or unexported fields
}

SpaceController implements the space resource.

func NewSpaceController

func NewSpaceController(service *goa.Service, app application.Application) *SpaceController

NewSpaceController creates a space controller.

func (*SpaceController) Create

func (c *SpaceController) Create(ctx *app.CreateSpaceContext) error

Create runs the create action.

func (*SpaceController) Delete

func (c *SpaceController) Delete(ctx *app.DeleteSpaceContext) error

Delete runs the delete action.

func (*SpaceController) ListTeams

func (c *SpaceController) ListTeams(ctx *app.ListTeamsSpaceContext) error

ListTeams runs the listTeams action.

type StatusController

type StatusController struct {
	*goa.Controller
	// contains filtered or unexported fields
}

StatusController implements the status resource.

func NewStatusController

func NewStatusController(service *goa.Service, dbChecker DBChecker, config statusConfiguration) *StatusController

NewStatusController creates a status controller.

func (*StatusController) Show

Show runs the show action.

type TeamController

type TeamController struct {
	*goa.Controller
	// contains filtered or unexported fields
}

TeamController implements the team resource.

func NewTeamController

func NewTeamController(service *goa.Service, app application.Application) *TeamController

NewTeamController creates a team controller.

func (*TeamController) Create

func (c *TeamController) Create(ctx *app.CreateTeamContext) error

Create runs the create action.

func (*TeamController) List

func (c *TeamController) List(ctx *app.ListTeamContext) error

List runs the list action.

type TokenController

type TokenController struct {
	*goa.Controller

	TokenManager  manager.TokenManager
	Configuration TokenControllerConfiguration
	// contains filtered or unexported fields
}

TokenController implements the login resource.

func NewTokenController

func NewTokenController(service *goa.Service, app application.Application, tokenManager manager.TokenManager,
	configuration TokenControllerConfiguration) *TokenController

NewTokenController creates a token controller.

func (*TokenController) Audit

func (c *TokenController) Audit(ctx *app.AuditTokenContext) error

func (*TokenController) Delete

func (c *TokenController) Delete(ctx *app.DeleteTokenContext) error

Delete deletes the stored external provider token.

func (*TokenController) Exchange

func (c *TokenController) Exchange(ctx *app.ExchangeTokenContext) error

Exchange provides OAuth2 and OpenID Connect token exchange. Currently only grant_type="client_credentials", "authorization_code", and "refresh_token" are supported.

grant_type="client_credentials" allows clients to authenticate using a service account ID and secret value. A service account token is returned as the result of successful exchange.

grant_type="authorization_code" is part of OAuth2 authorization flow.

grant_type="refresh_token" covers OpenID Connect token refresh flow.

func (*TokenController) Keys

func (c *TokenController) Keys(ctx *app.KeysTokenContext) error

Keys returns public keys which should be used to verify tokens

func (c *TokenController) Link(ctx *app.LinkTokenContext) error

Link links the user account to an external resource provider such as GitHub

func (*TokenController) LinkCallback

func (c *TokenController) LinkCallback(ctx *app.LinkCallbackTokenContext) error

LinkCallback is called by an external oauth2 resource provider such as GitHub as part of user's account linking flow

func (*TokenController) Refresh

func (c *TokenController) Refresh(ctx *app.RefreshTokenContext) error

Refresh obtains a new access token using the refresh token.

func (*TokenController) Retrieve

func (c *TokenController) Retrieve(ctx *app.RetrieveTokenContext) error

Retrieve fetches the stored external provider token.

func (*TokenController) Status

func (c *TokenController) Status(ctx *app.StatusTokenContext) error

Status checks if the stored external provider token is available.

type TokenControllerConfiguration

type TokenControllerConfiguration interface {
	provider.IdentityProviderConfiguration
	IsPostgresDeveloperModeEnabled() bool
	GetServiceAccounts() map[string]configuration.ServiceAccount
	GetPublicOAuthClientID() string
}

type UserController

type UserController struct {
	*goa.Controller
	// contains filtered or unexported fields
}

UserController implements the user resource.

func NewUserController

func NewUserController(service *goa.Service, app application.Application, config UserControllerConfiguration,
	tokenManager manager.TokenManager, tenantService appservice.TenantService) *UserController

NewUserController creates a user controller.

func (*UserController) ListResources

func (c *UserController) ListResources(ctx *app.ListResourcesUserContext) error

ListResources returns a list of resources in which the current user has a role

func (*UserController) Show

func (c *UserController) Show(ctx *app.ShowUserContext) error

Show returns the authorized user based on the provided Token

type UserControllerConfiguration

type UserControllerConfiguration interface {
	GetCacheControlUser() string
}

UserControllerConfiguration the Configuration for the UserController

type UserServiceController

type UserServiceController struct {
	*goa.Controller
	// contains filtered or unexported fields
}

UserServiceController implements the UserService resource.

func NewUserServiceController

func NewUserServiceController(service *goa.Service, app application.Application) *UserServiceController

NewUserServiceController creates a UserService controller.

func (*UserServiceController) Show

Show runs the show action.

type UserinfoController

type UserinfoController struct {
	*goa.Controller
	// contains filtered or unexported fields
}

UserinfoController implements the userinfo resource.

func NewUserinfoController

func NewUserinfoController(service *goa.Service, app application.Application, tokenManager manager.TokenManager) *UserinfoController

NewUserinfoController creates a userinfo controller.

func (*UserinfoController) Show

Show runs the show action, used in the OAuth/OpenID connect authentication flow

type UsersController

type UsersController struct {
	*goa.Controller

	EmailVerificationService service.EmailVerificationService
	// contains filtered or unexported fields
}

UsersController implements the users resource.

func NewUsersController

func NewUsersController(service *goa.Service, app application.Application, config UsersControllerConfiguration) *UsersController

NewUsersController creates a users controller.

func (*UsersController) Create

func (c *UsersController) Create(ctx *app.CreateUsersContext) error

Create creates a user when requested using a service account token

func (*UsersController) List

func (c *UsersController) List(ctx *app.ListUsersContext) error

List runs the list action.

func (*UsersController) ListTokens

func (c *UsersController) ListTokens(ctx *app.ListTokensUsersContext) error

ListTokens lists all of the tokens for the specified identity. This endpoint may only be invoked via the admin console service account

func (*UsersController) RevokeAllTokens

func (c *UsersController) RevokeAllTokens(ctx *app.RevokeAllTokensUsersContext) error

func (*UsersController) SendEmailVerificationCode

func (c *UsersController) SendEmailVerificationCode(ctx *app.SendEmailVerificationCodeUsersContext) error

SendEmailVerificationCode sends out a verification code to the user's email address

func (*UsersController) Show

func (c *UsersController) Show(ctx *app.ShowUsersContext) error

Show runs the show action.

func (*UsersController) Update

func (c *UsersController) Update(ctx *app.UpdateUsersContext) error

TODO move business logic to the user service Update updates the authorized user based on the provided Token

func (*UsersController) VerifyEmail

func (c *UsersController) VerifyEmail(ctx *app.VerifyEmailUsersContext) error

VerifyEmail verifies a user's email when updated.

type UsersControllerConfiguration

type UsersControllerConfiguration interface {
	GetCacheControlUsers() string
	GetCacheControlUser() string
	GetWITURL() (string, error)
	GetEmailVerifiedRedirectURL() string
	GetInternalUsersEmailAddressSuffix() string
	GetIgnoreEmailInProd() string
	GetOAuthProviderClientID() string
	GetOAuthProviderClientSecret() string
}

UsersControllerConfiguration the Configuration for the UsersController

Jump to

Keyboard shortcuts

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