Documentation
¶
Overview ¶
* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0
* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0
* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0
* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0
Index ¶
- Constants
- func GetAuthProperties(fileSystem files.FileSystem, galasaHome utils.GalasaHome, ...) (galasaapi.AuthProperties, error)
- func GetAuthenticatedAPIClient(apiServerUrl string, fileSystem files.FileSystem, galasaHome utils.GalasaHome, ...) *galasaapi.APIClient
- func GetBearerTokenFromTokenJsonFile(fileSystem files.FileSystem, galasaHome utils.GalasaHome, ...) (string, error)
- func GetJwtFromRestApi(apiServerUrl string, authProperties galasaapi.AuthProperties) (string, error)
- func IsBearerTokenValid(bearerTokenString string, timeService utils.TimeService) bool
- func Login(apiServerUrl string, fileSystem files.FileSystem, galasaHome utils.GalasaHome, ...) error
- func Logout(fileSystem files.FileSystem, galasaHome utils.GalasaHome) error
- func WriteBearerTokenJsonFile(fileSystem files.FileSystem, galasaHome utils.GalasaHome, jwt string) error
- type BearerTokenJson
Constants ¶
const ( TOKEN_PROPERTY = "GALASA_TOKEN" TOKEN_SEPARATOR = ":" )
const (
TOKEN_EXPIRY_BUFFER_MINUTES = 10
)
Variables ¶
This section is empty.
Functions ¶
func GetAuthProperties ¶
func GetAuthProperties(fileSystem files.FileSystem, galasaHome utils.GalasaHome, env utils.Environment) (galasaapi.AuthProperties, error)
Gets authentication properties from the user's galasactl.properties file or from the environment or a mixture.
func GetAuthenticatedAPIClient ¶
func GetAuthenticatedAPIClient( apiServerUrl string, fileSystem files.FileSystem, galasaHome utils.GalasaHome, timeService utils.TimeService, env utils.Environment, ) *galasaapi.APIClient
Gets a new authenticated API client, attempting to log in if a bearer token file does not exist
func GetBearerTokenFromTokenJsonFile ¶
func GetBearerTokenFromTokenJsonFile(fileSystem files.FileSystem, galasaHome utils.GalasaHome, timeService utils.TimeService) (string, error)
Gets the JWT from the bearer-token.json file if it exists, errors if the file does not exist or if the token is invalid
func GetJwtFromRestApi ¶
func GetJwtFromRestApi(apiServerUrl string, authProperties galasaapi.AuthProperties) (string, error)
Gets a JSON Web Token (JWT) from the API server's /auth endpoint
func IsBearerTokenValid ¶
func IsBearerTokenValid(bearerTokenString string, timeService utils.TimeService) bool
Checks whether a given bearer token is valid or not, returning true if it is valid and false otherwise
func Login ¶
func Login(apiServerUrl string, fileSystem files.FileSystem, galasaHome utils.GalasaHome, env utils.Environment) error
Login - performs all the logic to implement the `galasactl auth login` command
func Logout ¶
func Logout(fileSystem files.FileSystem, galasaHome utils.GalasaHome) error
func WriteBearerTokenJsonFile ¶
func WriteBearerTokenJsonFile(fileSystem files.FileSystem, galasaHome utils.GalasaHome, jwt string) error
Writes a new bearer-token.json file containing a JWT in the following format:
{
"jwt": "<bearer-token-here>"
}
Types ¶
type BearerTokenJson ¶
type BearerTokenJson struct {
Jwt string `json:"jwt"`
}