github.com/semaphoreui/semaphore/api
No package summary is available.
Package
Files: 13. Third party imports: 10. Imports from organisation: 0. Tests: 0. Benchmarks: 0.
Vars
Types
LoginAuthMethods
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| Totp |
|
No comment on field. |
LoginTotpAuthMethod
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| AllowRecovery |
|
No comment on field. |
claimResult
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| username |
|
No comment on field. |
| name |
|
No comment on field. |
|
No comment on field. |
loginMetadata
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| OidcProviders |
|
No comment on field. |
| LoginWithPassword |
|
No comment on field. |
| AuthMethods |
|
No comment on field. |
loginMetadataOidcProvider
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| ID |
|
No comment on field. |
| Name |
|
No comment on field. |
| Color |
|
No comment on field. |
| Icon |
|
No comment on field. |
minimalUser
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| ID |
|
No comment on field. |
| Username |
|
No comment on field. |
| Name |
|
No comment on field. |
runnerWithToken
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
|
No comment on field. | |
| Token |
|
No comment on field. |
| PrivateKey |
|
No comment on field. |
totpRecoveryRequestBody
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| RecoveryCode |
|
No comment on field. |
totpRequestBody
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| Passcode |
|
No comment on field. |
Functions
func DelayMiddleware
DelayMiddleware adds artificial delay to simulate slow network conditions
Uses: http.Handler, http.HandlerFunc, http.Request, http.ResponseWriter, time.Sleep.func Extract
func ExtractAsAnyForTaskParams
func JSONMiddleware
JSONMiddleware ensures that all the routes respond with Json, this is added by default to all routes
Uses: http.HandlerFunc, http.Request, http.ResponseWriter.func Match
func MatchCompare
func ReceiveIntegration
func Route
Route declares all routes
Uses: db.CanManageProjectResources, db.CanManageProjectUsers, db.CanRunProjectTasks, db.CanUpdateProject, debug.Dump, debug.GC, http.HandlerFunc, log.Fields, log.WithError, mux.CORSMethodMiddleware, mux.NewRouter, os.Getenv, projects.AddEnvironment, projects.AddIntegration, projects.AddIntegrationAlias, projects.AddIntegrationExtractValue, projects.AddIntegrationMatcher, projects.AddInventory, projects.AddKey, projects.AddProject, projects.AddRepository, projects.AddRunner, projects.AddSchedule, projects.AddTask, projects.AddTemplate, projects.AddTerraformInventoryAlias, projects.AddUser, projects.AddView, projects.AttachInventory, projects.ClearCache, projects.ClearRunnerCache, projects.ConfirmTask, projects.DeleteIntegration, projects.DeleteIntegrationExtractValue, projects.DeleteIntegrationMatcher, projects.DeleteProject, projects.DeleteRunner, projects.DeleteTerraformInventoryAlias, projects.DeleteTerraformInventoryState, projects.DetachInventory, projects.EnvironmentMiddleware, projects.GetAllTasks, projects.GetAnsibleTaskErrors, projects.GetAnsibleTaskHosts, projects.GetBackup, projects.GetEnvironment, projects.GetEnvironmentRefs, projects.GetIntegration, projects.GetIntegrationAlias, projects.GetIntegrationExtractValue, projects.GetIntegrationExtractValueRefs, projects.GetIntegrationExtractValues, projects.GetIntegrationMatcher, projects.GetIntegrationMatcherRefs, projects.GetIntegrationMatchers, projects.GetIntegrationRefs, projects.GetIntegrations, projects.GetInventory, projects.GetInventoryRefs, projects.GetKeyRefs, projects.GetKeys, projects.GetLastTasks, projects.GetMustCanMiddleware, projects.GetProject, projects.GetProjectSchedules, projects.GetProjects, projects.GetRepositories, projects.GetRepositoryBranches, projects.GetRepositoryRefs, projects.GetRunner, projects.GetRunnerTags, projects.GetRunners, projects.GetSchedule, projects.GetTask, projects.GetTaskMiddleware, projects.GetTaskOutput, projects.GetTaskRawOutput, projects.GetTaskStages, projects.GetTaskStats, projects.GetTemplate, projects.GetTemplateRefs, projects.GetTemplateSchedules, projects.GetTemplates, projects.GetTerraformInventoryAlias, projects.GetTerraformInventoryAliases, projects.GetTerraformInventoryLatestState, projects.GetTerraformInventoryState, projects.GetTerraformInventoryStates, projects.GetUserRole, projects.GetUsers, projects.GetViewTemplates, projects.GetViews, projects.IntegrationMiddleware, projects.InventoryMiddleware, projects.KeyMiddleware, projects.LeftProject, projects.ProjectMiddleware, projects.RejectTask, projects.RemoveEnvironment, projects.RemoveIntegrationAlias, projects.RemoveInventory, projects.RemoveKey, projects.RemoveRepository, projects.RemoveSchedule, projects.RemoveTask, projects.RemoveTemplate, projects.RemoveUser, projects.RemoveView, projects.RepositoryMiddleware, projects.Restore, projects.RunnerMiddleware, projects.SchedulesMiddleware, projects.SetRunnerActive, projects.SetScheduleActive, projects.SetTemplateInventory, projects.SetTerraformInventoryAliasAccessKey, projects.SetViewPositions, projects.StopTask, projects.TemplatesMiddleware, projects.UpdateEnvironment, projects.UpdateIntegration, projects.UpdateIntegrationExtractValue, projects.UpdateIntegrationMatcher, projects.UpdateInventory, projects.UpdateKey, projects.UpdateProject, projects.UpdateRepository, projects.UpdateRunner, projects.UpdateSchedule, projects.UpdateTemplate, projects.UpdateTemplateDescription, projects.UpdateUser, projects.UpdateView, projects.UserMiddleware, projects.ValidateScheduleCronFormat, projects.ViewMiddleware, runners.GetRunner, runners.RegisterRunner, runners.RunnerMiddleware, runners.UnregisterRunner, runners.UpdateRunner, sockets.Handler, strings.HasSuffix, tasks.DeleteTask, tasks.GetTasks, tasks.TaskMiddleware, time.ParseDuration, util.Config, util.WebHostURL.func RunIntegration
func StoreMiddleware
StoreMiddleware WTF?
Uses: db.StoreSession, helpers.Store, http.HandlerFunc, http.Request, http.ResponseWriter, util.RandString.func TerraformInventoryAliasMiddleware
Private functions
func addGlobalRunner
func addTerraformState
func addUser
func adminMiddleware
func appMiddleware
func authentication
nolint: gocyclo
References: http.HandlerFunc, http.Request, http.ResponseWriter.func authenticationHandler
func authenticationWithStore
nolint: gocyclo
References: db.StoreSession, helpers.Store, http.HandlerFunc, http.Request, http.ResponseWriter.func claimOidcToken
func claimOidcUserInfo
func clearCache
func clearGlobalRunnerCache
func convertEntryToMap
func createAPIToken
func createSession
createSession creates session for passed user and stores session details in cookies.
References: db.Session, db.SessionVerificationMethod, db.SessionVerificationNone, db.SessionVerificationTotp, helpers.Store, helpers.WriteErrorStatus, http.Cookie, http.SetCookie, http.StatusInternalServerError, log.Error, tz.Now, util.Config, util.Cookie.func debugPrintRoutes
func deleteAPIToken
func deleteApp
func deleteGlobalRunner
func deleteUser
func disableTotp
func enableTotp
func generateStateOauthCookie
func getAPITokens
func getAllEvents
func getAllRunners
func getApp
func getApps
func getEvents
nolint: gocyclo
References: context.Get, context.GetOk, db.Event, db.Project, db.RetrieveQueryParams, db.User, helpers.Store, helpers.WriteError, helpers.WriteJSON, http.StatusOK.func getGlobalRunner
func getLastEvents
func getOidcProvider
func getOptions
func getRandomProfileName
func getRandomUsername
func getSecretFromFile
func getSession
func getSystemInfo
func getTerraformState
func getUser
func getUserMiddleware
func getUsers
func globalRunnerMiddleware
func hmacHashPayload
hmacHashPayload computes the hash of payload's body according to the webhook's secret token see https://developer.github.com/webhooks/securing/#validating-payloads-from-github returning the hash as a hexadecimal string
References: fmt.Sprintf, hmac.New, sha256.New.func isValidHmacPayload
isValidHmacPayload checks if the GitHub payload's hash fits with the hash computed by GitHub sent as a header
References: hmac.Equal, strings.HasPrefix.func lockTerraformState
func login
nolint: gocyclo
References: db.ErrNotFound, db.User, db.ValidationError, errors.As, errors.Is, helpers.Bind, helpers.Store, helpers.WriteJSON, http.StatusInternalServerError, http.StatusNoContent, http.StatusOK, http.StatusUnauthorized, log.Error, log.Warn, sort.Slice, strings.ToLower, util.Config.func loginByLDAP
func loginByPassword
func logout
logout handles the user logout process by expiring the current session and clearing the session cookie.
Behavior:
- If a valid session exists, it is expired in the database.
- The session cookie is cleared by setting its value to an empty string and its expiration date to a past time.
Responses:
- 204 No Content: Logout successful.
- 500 Internal Server Error: An error occurred while expiring the session.
func oidcLogin
func oidcRedirect
func parseClaim
func parseClaims
func plainTextMiddleware
plainTextMiddleware resets headers to Plain Text if needed
References: http.HandlerFunc, http.Request, http.ResponseWriter.func pongHandler
func prepareClaims
func readonlyUserMiddleware
func recoverySession
recoverySession handles the recovery of a user session using a recovery code. It validates the recovery code provided by the user and, if valid, verifies the session. If the recovery code is invalid or recovery is not allowed, it returns an appropriate HTTP status code.
HTTP Request:
- Method: POST
- Body: JSON object containing the recovery code (e.g., {"recovery_code": "code"}).
Responses:
- 204 No Content: Recovery successful, session verified.
- 400 Bad Request: Invalid request body or user does not have TOTP enabled.
- 401 Unauthorized: Invalid recovery code or session not found.
- 403 Forbidden: TOTP recovery is disabled.
- 500 Internal Server Error: An unexpected error occurred.
Preconditions:
- The session must exist and be valid.
- TOTP recovery must be enabled in the configuration.
Parameters:
- w: The HTTP response writer.
- r: The HTTP request.
func serveFile
func servePublic
func setApp
func setAppActive
func setAppOption
func setGlobalRunnerActive
func setOption
func startEmailVerification
func structToFlatMap
func totpQr
func tryFindLDAPUser
func unlockTerraformState
func updateGlobalRunner
func updateUser
func updateUserPassword
func validateAppID
func verifySession
func verifySessionByEmail
Tests
Files: 4. Third party imports: 0. Imports from organisation: 0. Tests: 8. Benchmarks: 0.