Documentation ¶
Index ¶
- func HelloWorld(rw http.ResponseWriter, req *http.Request)
- func ShowUI(rw http.ResponseWriter, req *http.Request)
- type AuthResponse
- type ErrorResponse
- type NewUserRequest
- type OAuthRequest
- type OAuthResponse
- type OverviewResponse
- type SearchRequest
- type Service
- func (service Service) AddActionsToResource(rw http.ResponseWriter, req *http.Request)
- func (service Service) AddGroup(rw http.ResponseWriter, req *http.Request)
- func (service Service) AddPolicy(rw http.ResponseWriter, req *http.Request)
- func (service Service) AddResource(rw http.ResponseWriter, req *http.Request)
- func (service Service) AddRole(rw http.ResponseWriter, req *http.Request)
- func (service Service) AddUser(rw http.ResponseWriter, req *http.Request)
- func (service Service) AddUsersToGroup(rw http.ResponseWriter, req *http.Request)
- func (service Service) AttachPoliciesToRole(rw http.ResponseWriter, req *http.Request)
- func (service Service) AttachPolicyToGroups(rw http.ResponseWriter, req *http.Request)
- func (service Service) AttachPolicyToUsers(rw http.ResponseWriter, req *http.Request)
- func (service Service) AttachRoleToGroups(rw http.ResponseWriter, req *http.Request)
- func (service Service) AttachRoleToUsers(rw http.ResponseWriter, req *http.Request)
- func (service Service) BeginTOTPEnrollment(rw http.ResponseWriter, req *http.Request)
- func (service Service) FinishTOTPEnrollment(rw http.ResponseWriter, req *http.Request)
- func (service Service) GetAllGroups(rw http.ResponseWriter, req *http.Request)
- func (service Service) GetAllPolicies(rw http.ResponseWriter, req *http.Request)
- func (service Service) GetAllResources(rw http.ResponseWriter, req *http.Request)
- func (service Service) GetAllRoles(rw http.ResponseWriter, req *http.Request)
- func (service Service) GetAllUsers(rw http.ResponseWriter, req *http.Request)
- func (service Service) GetGroup(rw http.ResponseWriter, req *http.Request)
- func (service Service) GetOverview(rw http.ResponseWriter, req *http.Request)
- func (service Service) GetPoliciesForUser(rw http.ResponseWriter, req *http.Request)
- func (service Service) GetPolicy(rw http.ResponseWriter, req *http.Request)
- func (service Service) GetResource(rw http.ResponseWriter, req *http.Request)
- func (service Service) GetRole(rw http.ResponseWriter, req *http.Request)
- func (service Service) GetTOTPEnrollmentImage(rw http.ResponseWriter, req *http.Request)
- func (service Service) GetTokenForCredentials(rw http.ResponseWriter, req *http.Request)
- func (service Service) GetUser(rw http.ResponseWriter, req *http.Request)
- func (service Service) IsRequestAuthorized(rw http.ResponseWriter, req *http.Request)
- func (service Service) Search(rw http.ResponseWriter, req *http.Request)
- type SystemResponse
- type TokenResponse
- type TotpEnrollmentFinishRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HelloWorld ¶
func HelloWorld(rw http.ResponseWriter, req *http.Request)
HelloWorld emits a hello world
Types ¶
type AuthResponse ¶
type AuthResponse struct {
Authorized bool `json:"authorized"`
}
AuthResponse is a response structure returned after validating a request
type ErrorResponse ¶
ErrorResponse represents an API response
type NewUserRequest ¶
NewUserRequest is a request to create a new user. This is really the only type of requests
that requires a specific request type -- because a new user request includes a password
type OAuthRequest ¶
type OAuthRequest struct { GrantType string `json:"grant_type"` ClientID string `json:"client_id"` ClientSecret string `json:"client_secret"` Scope string `json:"scope"` UserName string `json:"username"` Password string `json:"password"` CSRFToken string `json:"state"` RedirectURI string `json:"redirect_uri"` ResponseType string `json:"response_type"` Code string `json:"code"` }
OAuthRequest is an OAuth2 based request. For more information on the various grant types that can use this request object: https://alexbilbie.com/guide-to-oauth-2-grants/
type OAuthResponse ¶
type OAuthResponse struct { TokenType string `json:"token_type"` ExpiresIn string `json:"expires_in"` AccessToken string `json:"access_token"` RefreshToken string `json:"refresh_token"` }
OAuthResponse is an OAuth2 based response
type OverviewResponse ¶
type OverviewResponse struct { SystemOverview data.SystemOverview `json:"overview"` Uptime string `json:"uptime"` UserName string `json:"user_name"` UserDescription string `json:"user_description"` }
OverviewResponse represents a response to the GetOverview call
type SearchRequest ¶
type SearchRequest struct {
SearchExpression string `json:"expression"`
}
SearchRequest represents a request to search for information
type Service ¶
Service encapsulates API service operations
func (Service) AddActionsToResource ¶
func (service Service) AddActionsToResource(rw http.ResponseWriter, req *http.Request)
AddActionsToResource adds action(s) to a resource. If the bearer token is not authorized for the operation, StatusUnauthorized is returned
func (Service) AddGroup ¶
func (service Service) AddGroup(rw http.ResponseWriter, req *http.Request)
AddGroup adds a group. If the bearer token is not authorized for the operation, StatusUnauthorized is returned
func (Service) AddPolicy ¶
func (service Service) AddPolicy(rw http.ResponseWriter, req *http.Request)
AddPolicy adds a policy. If the bearer token is not authorized for the operation, StatusUnauthorized is returned
func (Service) AddResource ¶
func (service Service) AddResource(rw http.ResponseWriter, req *http.Request)
AddResource adds a resource. If the bearer token is not authorized for the operation, StatusUnauthorized is returned
func (Service) AddRole ¶
func (service Service) AddRole(rw http.ResponseWriter, req *http.Request)
AddRole adds a role. If the bearer token is not authorized for the operation, StatusUnauthorized is returned
func (Service) AddUser ¶
func (service Service) AddUser(rw http.ResponseWriter, req *http.Request)
AddUser adds a user. If the bearer token is not authorized for the operation, StatusUnauthorized is returned
func (Service) AddUsersToGroup ¶
func (service Service) AddUsersToGroup(rw http.ResponseWriter, req *http.Request)
AddUsersToGroup adds user(s) to a group. If the bearer token is not authorized for the operation, StatusUnauthorized is returned
func (Service) AttachPoliciesToRole ¶
func (service Service) AttachPoliciesToRole(rw http.ResponseWriter, req *http.Request)
AttachPoliciesToRole attaches policy(s) to a role. If the bearer token is not authorized for the operation, StatusUnauthorized is returned
func (Service) AttachPolicyToGroups ¶
func (service Service) AttachPolicyToGroups(rw http.ResponseWriter, req *http.Request)
AttachPolicyToGroups attaches group(s) to a policy. If the bearer token is not authorized for the operation, StatusUnauthorized is returned
func (Service) AttachPolicyToUsers ¶
func (service Service) AttachPolicyToUsers(rw http.ResponseWriter, req *http.Request)
AttachPolicyToUsers attaches user(s) to a policy. If the bearer token is not authorized for the operation, StatusUnauthorized is returned
func (Service) AttachRoleToGroups ¶
func (service Service) AttachRoleToGroups(rw http.ResponseWriter, req *http.Request)
AttachRoleToGroups attaches group(s) to a role. If the bearer token is not authorized for the operation, StatusUnauthorized is returned
func (Service) AttachRoleToUsers ¶
func (service Service) AttachRoleToUsers(rw http.ResponseWriter, req *http.Request)
AttachRoleToUsers attaches user(s) to a role. If the bearer token is not authorized for the operation, StatusUnauthorized is returned
func (Service) BeginTOTPEnrollment ¶
func (service Service) BeginTOTPEnrollment(rw http.ResponseWriter, req *http.Request)
BeginTOTPEnrollment begins TOTP (two factor auth) enrollment. If the bearer token is not authorized for the operation, StatusUnauthorized is returned
func (Service) FinishTOTPEnrollment ¶
func (service Service) FinishTOTPEnrollment(rw http.ResponseWriter, req *http.Request)
FinishTOTPEnrollment finishes TOTP (two factor auth) enrollment by verifying the first code. If the bearer token is not authorized for the operation, StatusUnauthorized is returned
func (Service) GetAllGroups ¶
func (service Service) GetAllGroups(rw http.ResponseWriter, req *http.Request)
GetAllGroups gets all group information. If the bearer token is not authorized for the operation, StatusUnauthorized is returned
func (Service) GetAllPolicies ¶
func (service Service) GetAllPolicies(rw http.ResponseWriter, req *http.Request)
GetAllPolicies gets all policies in the system. If the bearer token is not authorized for the operation, StatusUnauthorized is returned
func (Service) GetAllResources ¶
func (service Service) GetAllResources(rw http.ResponseWriter, req *http.Request)
GetAllResources gets all resources in the system. If the bearer token is not authorized for the operation, StatusUnauthorized is returned
func (Service) GetAllRoles ¶
func (service Service) GetAllRoles(rw http.ResponseWriter, req *http.Request)
GetAllRoles gets all role information. If the bearer token is not authorized for the operation, StatusUnauthorized is returned
func (Service) GetAllUsers ¶
func (service Service) GetAllUsers(rw http.ResponseWriter, req *http.Request)
GetAllUsers gets all users in the system. If the bearer token is not authorized for the operation, StatusUnauthorized is returned
func (Service) GetGroup ¶
func (service Service) GetGroup(rw http.ResponseWriter, req *http.Request)
GetGroup gets group information. If the bearer token is not authorized for the operation, StatusUnauthorized is returned
func (Service) GetOverview ¶
func (service Service) GetOverview(rw http.ResponseWriter, req *http.Request)
GetOverview gets the system overview information. If the bearer token is not authorized for the operation, StatusUnauthorized is returned
func (Service) GetPoliciesForUser ¶
func (service Service) GetPoliciesForUser(rw http.ResponseWriter, req *http.Request)
GetPoliciesForUser gets all policies for a given user. If the bearer token is not authorized for the operation, StatusUnauthorized is returned
func (Service) GetPolicy ¶
func (service Service) GetPolicy(rw http.ResponseWriter, req *http.Request)
GetPolicy gets a policy. If the bearer token is not authorized for the operation, StatusUnauthorized is returned
func (Service) GetResource ¶
func (service Service) GetResource(rw http.ResponseWriter, req *http.Request)
GetResource gets a resource. If the bearer token is not authorized for the operation, StatusUnauthorized is returned
func (Service) GetRole ¶
func (service Service) GetRole(rw http.ResponseWriter, req *http.Request)
GetRole gets role information. If the bearer token is not authorized for the operation, StatusUnauthorized is returned
func (Service) GetTOTPEnrollmentImage ¶
func (service Service) GetTOTPEnrollmentImage(rw http.ResponseWriter, req *http.Request)
GetTOTPEnrollmentImage gets the TOTP (two factor auth) enrollment image. If the bearer token is not authorized for the operation, StatusUnauthorized is returned
func (Service) GetTokenForCredentials ¶
func (service Service) GetTokenForCredentials(rw http.ResponseWriter, req *http.Request)
GetTokenForCredentials gets a bearer token for a given set of credentials
func (Service) GetUser ¶
func (service Service) GetUser(rw http.ResponseWriter, req *http.Request)
GetUser gets a user. If the bearer token is not authorized for the operation, StatusUnauthorized is returned
func (Service) IsRequestAuthorized ¶
func (service Service) IsRequestAuthorized(rw http.ResponseWriter, req *http.Request)
IsRequestAuthorized returns whether a request is authorized for a given bearer token and request object
type SystemResponse ¶
type SystemResponse struct { Status int `json:"status"` Message string `json:"message"` Data interface{} `json:"data"` }
SystemResponse is a response for a system request
type TokenResponse ¶
type TokenResponse struct { TokenType string `json:"token_type"` ExpiresIn string `json:"expires_in"` AccessToken string `json:"access_token"` }
TokenResponse is a response for a bearer token
type TotpEnrollmentFinishRequest ¶
type TotpEnrollmentFinishRequest struct {
PassCode string `json:"passcode"`
}
TotpEnrollmentFinishRequest represents a request to complete the TOTP enrollment request. A passcode (from the OTP device / authenticator app) is required to validate and complete the process