Documentation ¶
Index ¶
- Constants
- func ConvertTokenToIdentityUnsafe(tok string) (*ga4gh.Identity, error)
- func ExtractVariables(v string) (map[string]bool, error)
- func FilterStringsByPrefix(in []string, prefix string) []string
- func FutureTimestamp(ttl time.Duration) string
- func GenerateGUID() string
- func GetNowInUnix() int64
- func GetNowInUnixNano() float64
- func GetOIDCTokenVerifier(ctx context.Context, clientID, issuer string) (*oidc.IDTokenVerifier, error)
- func HasUserinfoClaims(id *ga4gh.Identity) bool
- func IsAudience(token *ga4gh.Identity, clientID, self string) bool
- func IsImageURL(src string) bool
- func IsLocale(name string) bool
- func IsTimeZone(name string) bool
- func IsURL(v string) bool
- func JoinNonEmpty(in []string, separator string) string
- func KeyTTL(maxRequestedTTL time.Duration, numKeys int) time.Duration
- func ListContains(list []string, find string) bool
- func Max(a, b int) int
- func Min(a, b int) int
- func ParseDuration(d string, def time.Duration) (time.Duration, error)
- func ParseGUID(in string) (uuid.UUID, error)
- func ParseNegDuration(d string, def time.Duration) (time.Duration, error)
- func ParseSeconds(d string) (time.Duration, error)
- func PastTimestamp(ttl time.Duration) string
- func QuoteSplit(str, separator string, stripQuotes bool) []string
- func ReplaceVariables(v string, args map[string]string) (string, error)
- func RequestAbstractPath(r *http.Request) string
- func TimestampString(epoch int64) string
- func ToTitle(str string) string
- func TokenUserID(token *ga4gh.Identity, maxLength int) string
- func TtlString(ttl time.Duration) string
- func UserID(subject, issuer string, maxLength int) string
- func VerifyTokenWithKey(publicKey *rsa.PublicKey, tok string) error
Constants ¶
const ( // UILabel is the name of the label key inside of UI config maps. UILabel = "label" // UIDescription is the name of the description key inside of UI config maps. UIDescription = "description" )
const (
DurationRegexpString = "^([0-9]+d)?([0-9]+h)?([0-9]+m)?([0-9]+s)?$"
)
Variables ¶
This section is empty.
Functions ¶
func ConvertTokenToIdentityUnsafe ¶
ConvertTokenToIdentityUnsafe unsafely converts a token to an identity.
func ExtractVariables ¶
ExtractVariables returns a map of variable names found within an input string.
func FilterStringsByPrefix ¶
FilterStringsByPrefix filters returns only strings that do NOT have a given prefix.
func FutureTimestamp ¶
func GenerateGUID ¶
func GenerateGUID() string
func GetNowInUnix ¶
func GetNowInUnix() int64
GetNowInUnix returns Unix timestamp in seconds, equivalent to `date "+%s"`.
func GetNowInUnixNano ¶
func GetNowInUnixNano() float64
GetNowInUnixNano returns Unix timestamp equivalent to `date "+%s.%N"`.
func GetOIDCTokenVerifier ¶
func GetOIDCTokenVerifier(ctx context.Context, clientID, issuer string) (*oidc.IDTokenVerifier, error)
GetOIDCTokenVerifier returns an OIDC token verifier for a particular client.
func HasUserinfoClaims ¶
HasUserinfoClaims checks if /userinfo endpoint needs to be called to fetch additional claims for a particular identity.
func IsAudience ¶
IsAudience returns true if the token's "azp" or "aud" contains the self string or clientID.
func IsImageURL ¶
IsImageURL returns true if the format of the string appears to be a URL image.
func IsLocale ¶
IsLocale returns true if the "name" provided is a locale name as per https://tools.ietf.org/html/bcp47.
func IsTimeZone ¶
IsTimeZone returns true if the "name" provided is an IANA Time Zone name.
func JoinNonEmpty ¶
JoinNonEmpty filters empty strings and joins remainder together.
func ListContains ¶
func ParseNegDuration ¶
ParseNegDuration parses durations that may sometimes be negative in value.
func ParseSeconds ¶
ParseSeconds returns a duration from a numeric string in seconds
func PastTimestamp ¶
PastTimestamp returns a timestamp string a given duration in the past.
func QuoteSplit ¶
QuoteSplit is similiar to strings.Split() but doesn't split within double-quotes.
func ReplaceVariables ¶
ReplaceVariables replaces all substrings of the form "${var-name}" based on args like {"var-name":"var-value"}.
func RequestAbstractPath ¶
func TimestampString ¶
TimestampString returns a RFC3339 date/time string.
func ToTitle ¶
ToTitle does some auto-formatting on camel-cased or snake-cased strings to make them look like titles.
func TokenUserID ¶
TokenUserID returns an user identifier for a given token.
Types ¶
This section is empty.