Documentation ¶
Overview ¶
Package sty_shared
This is the STY-Holdings shared services ¶
NOTES:
None
COPYRIGHT & WARRANTY:
Copyright (c) 2022 STY-Holdings, inc All rights reserved. This software is the confidential and proprietary information of STY-Holdings, Inc. Use is subject to license terms. Unauthorized copying of this file, via any medium is strictly prohibited. Proprietary and confidential Written by <Replace with FULL_NAME> / syacko STY-Holdings, Inc. support@sty-holdings.com www.sty-holdings.com 01-2024 USA Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package sty_shared
General description of the purpose of the go file.
RESTRICTIONS:
AWS functions: * Program must have access to a .aws/credentials file in the default location. * This will only access system parameters that start with '/sote' (ROOTPATH). * {Enter other restrictions here for AWS {Other catagories of restrictions} * {List of restrictions for the catagory
NOTES:
{Enter any additional notes that you believe will help the next developer.}
COPYRIGHT:
Copyright 2022 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- func AssumeRole(sessionPtr *AWSSession, idToken string) (parametersOutput awsSSM.GetParametersOutput, errorInfo pi.ErrorInfo)
- func GetId(sessionPtr *AWSSession, region, userPoolId string) (identityId string, errorInfo pi.ErrorInfo)
- func GetIdentityCredentials(sessionPtr *AWSSession, identityId string) (identityIdCredentials awsCI.GetCredentialsForIdentityOutput, ...)
- func GetParameters(sessionPtr *AWSSession, idToken string, ssmParameters ...string) (parametersOutput awsSSM.GetParametersOutput, errorInfo pi.ErrorInfo)
- func Login(loginType, username string, password *string, sessionPtr *AWSSession) (tokens map[string]string, errorInfo pi.ErrorInfo)
- func ParseAWSJWT(sessionPtr *AWSSession, tokenType, token string) (claims jwt.Claims, tokenValuePtr *jwt.Token, errorInfo pi.ErrorInfo)
- type AWSConfig
- type AWSSession
- type CognitoClaims
- type CognitoLogin
- func (csrp *CognitoLogin) GetAuthParams() map[string]string
- func (csrp *CognitoLogin) GetClientId() string
- func (csrp *CognitoLogin) GetSecretHash(username string) (string, pi.ErrorInfo)
- func (csrp *CognitoLogin) GetUserPoolId() string
- func (csrp *CognitoLogin) GetUserPoolName() string
- func (csrp *CognitoLogin) GetUsername() string
- func (csrp *CognitoLogin) PasswordVerifierChallenge(challengeParms map[string]string, ts time.Time) (map[string]string, pi.ErrorInfo)
- type Key
- type KeySet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssumeRole ¶ added in v2024.5.8
func AssumeRole( sessionPtr *AWSSession, idToken string, ) ( parametersOutput awsSSM.GetParametersOutput, errorInfo pi.ErrorInfo, )
AssumeRole - allows an authenticated user to assume the role provided.
Customer Messages: None Errors: None Verifications: None
func GetId ¶ added in v2024.5.8
func GetId( sessionPtr *AWSSession, region, userPoolId string, ) ( identityId string, errorInfo pi.ErrorInfo, )
GetId - will return System Manager parameters. WithDecryption is assumed.
Customer Messages: None Errors: None Verifications: None
func GetIdentityCredentials ¶ added in v2024.5.8
func GetIdentityCredentials( sessionPtr *AWSSession, identityId string, ) ( identityIdCredentials awsCI.GetCredentialsForIdentityOutput, errorInfo pi.ErrorInfo, )
GetIdentityCredentials - will return AWS temporary credentials.
Customer Messages: None Errors: None Verifications: None
func GetParameters ¶ added in v2024.5.4
func GetParameters( sessionPtr *AWSSession, idToken string, ssmParameters ...string, ) ( parametersOutput awsSSM.GetParametersOutput, errorInfo pi.ErrorInfo, )
GetParameters - will return System Manager parameters. WithDecryption is assumed.
Customer Messages: None Errors: None Verifications: None
func Login ¶ added in v2024.5.0
func Login( loginType, username string, password *string, sessionPtr *AWSSession, ) ( tokens map[string]string, errorInfo pi.ErrorInfo, )
Login - will validate and return tokens, if the login is successful.
Customer Messages: None Errors: None Verifications: None
func ParseAWSJWT ¶ added in v2024.5.3
func ParseAWSJWT( sessionPtr *AWSSession, tokenType, token string, ) ( claims jwt.Claims, tokenValuePtr *jwt.Token, errorInfo pi.ErrorInfo, )
ParseAWSJWT - will return the claims, if any, or an err if the AWS JWT is invalid. This will parse ID and Access tokens. Refresh token are not support and nothing is returned.
Customer Messages: None Errors: None Verifications: None
Types ¶
type AWSSession ¶ added in v2024.5.0
type AWSSession struct { AccessToken string BaseConfig aws.Config IdentityId string IDToken string IdentityIdCredentials awsCI.GetCredentialsForIdentityOutput KeySet KeySet KeySetURL string RefreshToken string STYConfig AWSConfig Username string }
func NewAWSConfig ¶ added in v2024.5.0
func NewAWSConfig(environment string) ( sessionPtr *AWSSession, errorInfo pi.ErrorInfo, )
NewAWSConfig - reads the SDKs default external configurations, and populates an AWS Config with the values from the external configurations.
Customer Messages: None Errors: ErrEnvironmentInvalid, anything awsConfig.LoadDefaultConfig or getPublicKeySet returns, Verifications: None
type CognitoClaims ¶ added in v2024.5.0
type CognitoClaims struct { AtHash string `json:"at_hash"` AuthTime int `json:"auth_time"` CognitoUsername string `json:"cognito:username"` Email string `json:"email"` EmailVerified bool `json:"email_verified"` PhoneNumber string `json:"phone_number"` PhoneNumberVerified bool `json:"phone_number_verified"` TokenUse string `json:"token_use"` UserName string `json:"username"` jwt.RegisteredClaims }
ToDo Is this needed
type CognitoLogin ¶ added in v2024.5.0
type CognitoLogin struct {
// contains filtered or unexported fields
}
CognitoLogin handles SRP authentication with AWS Cognito
func NewCognitoLogin ¶ added in v2024.5.0
func NewCognitoLogin( username, userPoolId, clientId string, password *string, clientSecret *string, ) ( *CognitoLogin, pi.ErrorInfo, )
NewCognitoLogin - creates a CognitoLogin object. If you have a clientSecret, we use a pointer so there is only one place in memory (Security).
Customer Messages: None Errors: None Verifications: None
func (*CognitoLogin) GetAuthParams ¶ added in v2024.5.0
func (csrp *CognitoLogin) GetAuthParams() map[string]string
GetAuthParams - returns the Auth Parameter map of values. If getSecret = true, then the client secret will be returned. If the client secret is missing, then authParams will be empty.
Customer Messages: None Errors: None Verifications: None
func (*CognitoLogin) GetClientId ¶ added in v2024.5.0
func (csrp *CognitoLogin) GetClientId() string
GetClientId - returns the configured Cognito Cient ID
Customer Messages: None Errors: None Verifications: None
func (*CognitoLogin) GetSecretHash ¶ added in v2024.5.0
func (csrp *CognitoLogin) GetSecretHash(username string) ( string, pi.ErrorInfo, )
GetSecretHash returns the secret hash string required to make certain Cognito Identity Provider API calls (if client is configured with a secret)
Customer Messages: None Errors: None Verifications: None
func (*CognitoLogin) GetUserPoolId ¶ added in v2024.5.0
func (csrp *CognitoLogin) GetUserPoolId() string
GetUserPoolId - returns the configured Cognito User Pool ID
Customer Messages: None Errors: None Verifications: None
func (*CognitoLogin) GetUserPoolName ¶ added in v2024.5.0
func (csrp *CognitoLogin) GetUserPoolName() string
GetUserPoolName - returns the configured Cognito User Pool Name
Customer Messages: None Errors: None Verifications: None
func (*CognitoLogin) GetUsername ¶ added in v2024.5.0
func (csrp *CognitoLogin) GetUsername() string
GetUsername - returns the configured Cognito user username
Customer Messages: None Errors: None Verifications: None
func (*CognitoLogin) PasswordVerifierChallenge ¶ added in v2024.5.0
func (csrp *CognitoLogin) PasswordVerifierChallenge( challengeParms map[string]string, ts time.Time, ) ( map[string]string, pi.ErrorInfo, )
PasswordVerifierChallenge - returns the ChallengeResponses map to be used inside the cognitoidentityprovider.RespondToAuthChallengeInput object which fulfils the PASSWORD_VERIFIER Cognito challenge
Customer Messages: None Errors: None Verifications: None