Additional Maverics packages (Legacy)
package "maverics/aws/config"
LoadDefaultConfig
func LoadDefaultConfig(ctx context.Context, optFns ...func(*LoadOptions) error) (cfg aws.Config, err error)
LoadDefaultConfig reads the SDK’s default external configurations, and populates an AWS Config with the values from the external configurations.
For more info on the AWS Config package, please see the library’s documentation.
WithRegion
func WithRegion(v string) LoadOptionsFunc
WithRegion is a helper function to construct functional options that sets Region on config’s LoadOptions. Setting the region to an empty string, will result in the region value being ignored. If multiple WithRegion calls are made, the last call overrides the previous call values.
For more info on the AWS Config package, please see the library’s documentation.
package "maverics/aws/signer/v4"
NewSigner
func NewSigner(optFns ...func(signer *SignerOptions)) *Signer
NewSigner returns a new SigV4 Signer.
For more info on the AWS Signer V4 package, please see the library’s documentation.
package "maverics/cbor"
func NewDecoder
func NewDecoder(r io.Reader) *Decoder
NewDecoder returns a new decoder that reads from r
. For more info on the UUID
package, please see the library’s documentation.
package "maverics/html"
func Parse
func Parse(r io.Reader) (*Node, error)
Parse returns the parse tree for the HTML from the given Reader. For more info on the HTML package, please see the library’s documentation.
type Node
type Node struct {
Parent, FirstChild, LastChild, PrevSibling, NextSibling *Node
Type NodeType
Data string
Namespace string
}
A Node consists of a NodeType and some Data and are part of a tree of Nodes.
type NodeType
const (
ElementNode = iota
)
A NodeType is the type of the Node of which only ElementNode is currently supported.
package "maverics/idp"
func CreateRequest
CreateRequest(opts ...idptype.LoginOption) idptype.LoginRequester
Enables the ability to add login options that can change the behavior of the authorization request. Examples shown below with various login options.
func WithUser
WithUser(attrs map[string]string) idptype.LoginOption
WithUser returns a login option that allows the user identity to be set.
// Example.
option := idp.WithUser(map[string]string{"username": "[email protected]"})
// Pass the option to the CreateRequest function.
idp.CreateRequest(option).Login(rw, req)
func WithLoginHint
WithLoginHint(loginHint string) idptype.LoginOption
WithLoginHint returns a login option that attaches a login hint to the authorization request. This login hint will be used by the respective IDP for pre-populating the login forms.
// Example.
option := idp.WithLoginHint("[email protected]")
// Pass the option to the CreateRequest function.
idp.CreateRequest(option).Login(rw, req)
package "maverics/jwt"
func ParseSigned
func ParseSigned(s string) (*JSONWebToken, error)
ParseSigned parses a signed JSON web token (JWT). For more info on the JWT package, please see the library’s documentation.
package "maverics/ldap"
To learn more about the LDAP package, please reference the library’s documentation.
func DialURL
DialURL(addr string, opts ...DialOpt) (*Conn, error)
DialURL
when successful returns a connection to the given LDAP address.
The following schemes are supported: ldap://
,ldaps://
, ldapi://
.
DialOpt
configures the DialContext.
After a successful Conn
is established, any of the connections methods
can be used.
func DialWithTLSConfig
DialWithTLSConfig(tc *tls.Config)
DialWithTLSConfig
is a DialOpt
that updates tls.Config in DialContext. This
allows dialing via TLS directly instead of having to upgrade the tcp connection to
TLS via conn.StartTLS
.
func NewModifyRequest
func NewModifyRequest(dn string, controls []Control) *ModifyRequest
NewModifyRequest
creates a modify request for the given DN
func NewPasswordModifyRequest
func NewPasswordModifyRequest(
userIdentity string,
oldPassword string,
newPassword string,
) *PasswordModifyRequest
NewPasswordModifyRequest
creates a new password modify request.
func NewSearchRequest
func NewSearchRequest(
BaseDN string,
Scope, DerefAliases, SizeLimit, TimeLimit int,
TypesOnly bool,
Filter string,
Attributes []string,
Controls []Control,
) *SearchRequest
NewSearchRequest
creates a new search request.
SearchRequest
options
scope choices:
const (
ScopeBaseObject = 0
ScopeSingleLevel = 1
ScopeWholeSubtree = 2
)
derefAliases:
const (
NeverDerefAliases = 0
DerefInSearching = 1
DerefFindingBaseObj = 2
DerefAlways = 3
)
package "maverics/log"
Package maverics/log
provides a way to log messages in Service Extensions. All log
records will be sent to stdout.
Log timestamps are always in UTC. For consistency, use time.Now().UTC()
instead
of time.Now()
when writing timestamps in a Service Extension.
func Debug
func Debug(keyvals ...interface{})
Debug will log a record at debug level.
func Info
func Info(keyvals ...interface{})
Info will log a record at info level.
func Error
func Error(keyvals ...interface{})
Error will log a record at error level.
package "maverics/mysql"
func Open
func Open(driverName, dataSourceName string) (*DB, error)
Open opens a database specified by its database driver name and a driver-specific
data source name, usually consisting of at least a database name and connection
information. The github.com/go-sql-driver/mysql
is the MySQL driver available for
use. For more info on the SQL package, please see the library’s
documentation.
package "maverics/pgx"
func Connect
Connect(ctx context.Context, connString string) (*Conn, error)
Connect establishes a connection with a Postgres database. For more info on the PGX package, please see the library’s documentation.
package "maverics/secret"
Hard coding secret strings directly in a Service Extension is a bad practice and
cumbersome when dealing with secrets that change. Package maverics/secret
provides
a secure way to fetch secrets.
func Get
func Get(key string) interface{}
Get retrieves the value for the given key from the secret provider configured at load time.
func GetString
func GetString(key string) string
GetString retrieves the value as a string for the given key from the secret provider configured at load time.
package "maverics/session"
func Get
func Get(req *http.Request, name string) interface{}
Get retrieves attributes that are already on the session.
func GetString
func GetString(req *http.Request, name string) string
GetString retrieves attributes that are already on the session.
func Set
func Set(req *http.Request, name string, value interface{})
Set will store a new attribute on the session that will be available for later use.
func ID
func ID(req *http.Request) string
ID will return the session’s identifier. The session ID should be treated as a secret and should not be exposed outside a Service Extension.
func GetSessionByID
func GetSessionByID(sessionID string) *Session
GetSessionByID will return the session associated with the ID.
func SetCookie
func SetCookie(rw http.ResponseWriter, req *http.Request)
SetCookie sets the Orchestrator’s session cookie on the response.
func SetAuthenticated
func SetAuthenticated(req *http.Request, namespace string, authenticated bool)
SetAuthenticated sets whether the session is authenticated or not.
type Session
Session represents a user’s state.
func (s *Session) Get
func (s *Session) Get(name string) interface{}
Get retrieves attributes that are already on the session.
func (s *Session) GetString
func (s *Session) GetString(name string) string
GetString retrieves attributes that are already on the session.
func (s *Session) Set
func (s *Session) Set(name string, value interface{})
Set will store a new attribute on the session that will be available for later use.
func (s *Session) ID
func (s *Session) ID() string
ID will return the session’s identifier. The session ID should be treated as a secret and should not be exposed outside a Service Extension.
package "maverics/tai"
func NewSignedJWT
func NewSignedJWT(cfg Config) (string, error)
NewSignedJWT constructs a signed JWT that the TAI module consumes and validates.
type Config
type Config struct {
// RSAPrivateKeyPEM is the pem-encoded RSA PKCS1 private key that will be used to
// sign the JWT.
RSAPrivateKeyPEM string
// Subject is the user's unique identifier. This value will be mapped to the
// JWT's 'sub' claim.
Subject string
// Lifetime is the duration of the token's lifetime. This value will be mapped
// to the JWT's 'exp' claim. The Lifetime should generally be set to match the
// lifetime of a user's session.
Lifetime time.Duration
}
Config represents the configuration options required to construct a signed JWT.
package "maverics/uuid"
func New
func New() UUID
New creates a new random UUID or panics. For more info on the UUID package, please see the library’s documentation.