connection

package
v0.17.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2023 License: MIT Imports: 19 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSignedJwtToken

func GetSignedJwtToken(key []byte, token *jwt.Token) (string, error)

GetSignedJwtToken Sign token with key

Types

type AuthenticationMode

type AuthenticationMode int
const (
	// JWT connect using JWT
	JWT AuthenticationMode = iota
	// WS connect websocket without auth
	WS
)

func (AuthenticationMode) GetEnumMap

func (value AuthenticationMode) GetEnumMap() *enummap.EnumMap

func (AuthenticationMode) MarshalJSON

func (value AuthenticationMode) MarshalJSON() ([]byte, error)

MarshalJSON marshal AuthenticationMode type

func (*AuthenticationMode) UnmarshalJSON

func (value *AuthenticationMode) UnmarshalJSON(arg []byte) error

UnmarshalJSON unmarshal AuthenticationMode

type ConnectFunc added in v0.16.5

type ConnectFunc func(reconnect bool) (string, error)

ConnectFunc connects to a sense environment, set reconnect to true if it's a reconnect and session in engine is expected. Returns App GUID.

type ConnectJWTSettings

type ConnectJWTSettings struct {
	// KeyPath path to jwt signing key
	KeyPath string `json:"keypath,omitempty" doc-key:"config.connectionSettings.jwtsettings.keypath"`
	// JwtHeader JWT headers as escaped json string. Custom headers to be added to the JWT header.
	// The strings for JwtHeader and Claims will be processed as a GO template
	// where User struct can be used
	//  struct {
	//	UserName  string
	// 	Password  string
	// 	Directory string
	// }
	// as well as the function "now" which corresponds to time.Now
	// The entries for "alg" and "typ" are added automatically to the header.
	// E.g. to add a key id header, "kid" add the following string
	// "{\"kid\":\"myKeyId\"}"
	JwtHeader synced.Template `json:"jwtheader,omitempty" doc-key:"config.connectionSettings.jwtsettings.jwtheader"`
	// Claims JWT claims as escaped json string. E.g. for an on prem JWT auth (with user and directory set as keys in QMC):
	// "{\"user\": \"{{.UserName}}\",\"directory\": \"{{.Directory}}\"}"
	// to add "iat":
	// "{\"iat\":{{now.Unix}}}"
	// or to add "exp" with 5 hours expiration
	// "{\"exp\":{{(now.Add 18000000000000).Unix}}}"
	Claims synced.Template `json:"claims,omitempty" doc-key:"config.connectionSettings.jwtsettings.claims"`

	// Alg is the signing method to be used for the JWT. Defaults to RS512 if omitted
	Alg string `json:"alg,omitempty" doc-key:"config.connectionSettings.jwtsettings.alg"`
	// contains filtered or unexported fields
}

ConnectJWTSettings app and server settings using JWT

func (*ConnectJWTSettings) GetConnectFunc

func (connectJWT *ConnectJWTSettings) GetConnectFunc(sessionState *session.State, connectionSettings *ConnectionSettings, appGUID, externalhost string, headers, customHeaders http.Header) ConnectFunc

GetConnectFunc which establishes a connection to Qlik Sense

func (*ConnectJWTSettings) GetJwtHeader

func (connectJWT *ConnectJWTSettings) GetJwtHeader(sessionState *session.State, header http.Header) (http.Header, error)

GetJwtHeader get Authorization header

func (*ConnectJWTSettings) Validate

func (connectJWT *ConnectJWTSettings) Validate() error

Validate connectJWTSettings

type ConnectWsSettings

type ConnectWsSettings struct{}

ConnectWsSettings app and server settings using WS

func (*ConnectWsSettings) GetConnectFunc

func (connectWs *ConnectWsSettings) GetConnectFunc(sessionState *session.State, connectionSettings *ConnectionSettings, appGUID, externalhost string, headers, customHeaders http.Header) ConnectFunc

GetConnectFunc get ws connect function

func (*ConnectWsSettings) Validate

func (connectWs *ConnectWsSettings) Validate() error

Validate open app scenario item

type ConnectionSettings

type ConnectionSettings struct {
	// Mode authentication mode, either JWT or WS
	Mode AuthenticationMode `json:"mode" doc-key:"config.connectionSettings.mode"`
	// JwtSettings JWT mode specific settings
	JwtSettings *ConnectJWTSettings `json:"jwtsettings,omitempty" doc-key:"config.connectionSettings.jwtsettings"`
	// WsSettings WS mode specific settings
	WsSettings *ConnectWsSettings `json:"wssettings,omitempty" doc-key:"config.connectionSettings.wssettings"`
	// Server remote host
	Server string `json:"server" doc-key:"config.connectionSettings.server"`
	// VirtualProxy sense virtual proxy used (added to connect path)
	VirtualProxy string `json:"virtualproxy" doc-key:"config.connectionSettings.virtualproxy"`
	// RawURL used to specify custom path for connection to sense app
	RawURL string `json:"rawurl,omitempty" doc-key:"config.connectionSettings.rawurl"`
	// Port port to be used, defaults to 80 or 443 depending on Security flag
	Port int `json:"port,omitempty" doc-key:"config.connectionSettings.port"`
	// Security use TLS
	Security bool `json:"security" doc-key:"config.connectionSettings.security"`
	// Allowuntrusted certificates
	Allowuntrusted bool `json:"allowuntrusted" doc-key:"config.connectionSettings.allowuntrusted"`
	// AppExt : By making this a pointer, we can check whether it was initialized
	// so that if omitted, it defaults to "app", but can be explicitly set to an empty string as well
	AppExt *string `json:"appext,omitempty" doc-key:"config.connectionSettings.appext"`
	// Header headers to add on the websocket connection
	Headers map[string]string `json:"headers" doc-key:"config.connectionSettings.headers"`
	// MaxFrameSize (Default 0 - No limit). Max size in bytes to be read on sense websocket. Limit exceeded yields an error.
	MaxFrameSize int64 `json:"maxframesize" doc-key:"config.connectionSettings.maxframesize"`
	// contains filtered or unexported fields
}

func (*ConnectionSettings) AllowUntrusted

func (connectionSettings *ConnectionSettings) AllowUntrusted() bool

AllowUntrusted implements session.ConnectionSettings interface

func (*ConnectionSettings) GetConnectFunc

func (connectionSettings *ConnectionSettings) GetConnectFunc(state *session.State, appGUID, externalhost string, customHeaders http.Header) (ConnectFunc, error)

GetConnectFunc Get function for connecting to sense

func (*ConnectionSettings) GetHeaders

func (connectionSettings *ConnectionSettings) GetHeaders(state *session.State, externalhost string) (http.Header, error)

GetHeaders Get auth headers

func (*ConnectionSettings) GetHost

func (connectionSettings *ConnectionSettings) GetHost() (string, error)

GetHost get hostname

func (*ConnectionSettings) GetRestUrl

func (connection *ConnectionSettings) GetRestUrl() (string, error)

func (*ConnectionSettings) GetURL

func (connection *ConnectionSettings) GetURL(appGUID, externalhost string) (string, error)

GetURL get websocket URL

func (*ConnectionSettings) Validate

func (connectionSettings *ConnectionSettings) Validate() error

Validate connection setttings

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL