Documentation ¶
Index ¶
- Constants
- func LogHTTPError(r *http.Response, innerErr error) error
- func NewHTTPShadowError(status int, userFacingError string, fmtString string, args ...interface{}) error
- func UpgradeToWebSocket(echoContext echo.Context) (*websocket.Conn, *time.Ticker, error)
- type CFInfo
- type CNSIRecord
- type CNSIRequest
- type ConnectedEndpoint
- type ConnectedUser
- type ConsoleConfig
- type EndpointDetail
- type EndpointPlugin
- type EndpointTokenRecord
- type ErrHTTPRequest
- type ErrHTTPShadow
- type Info
- type InfoFunc
- type JWTUserTokenInfo
- type LoginHookFunc
- type LoginRes
- type MiddlewarePlugin
- type OAuth2Metadata
- type PortalConfig
- type PortalProxy
- type ProxyRequestInfo
- type RoutePlugin
- type SessionStorer
- type StratosPlugin
- type TokenRecord
- type V2Info
- type VCapApplicationData
- type Versions
Constants ¶
View Source
const ( AuthTypeOAuth2 = "OAuth2" AuthTypeOIDC = "OIDC" AuthTypeHttpBasic = "HttpBasic" )
View Source
const (
AuthConnectTypeCreds = "creds"
)
Variables ¶
This section is empty.
Functions ¶
func NewHTTPShadowError ¶
Types ¶
type CNSIRecord ¶
type CNSIRecord struct { GUID string `json:"guid"` Name string `json:"name"` CNSIType string `json:"cnsi_type"` APIEndpoint *url.URL `json:"api_endpoint"` AuthorizationEndpoint string `json:"authorization_endpoint"` TokenEndpoint string `json:"token_endpoint"` DopplerLoggingEndpoint string `json:"doppler_logging_endpoint"` SkipSSLValidation bool `json:"skip_ssl_validation"` }
TODO this could be moved back to cnsis subpackage, and extensions could import it?
type CNSIRequest ¶
type CNSIRequest struct { GUID string `json:"-"` UserGUID string `json:"-"` Method string `json:"-"` Body []byte `json:"-"` Header http.Header `json:"-"` URL *url.URL `json:"-"` StatusCode int `json:"statusCode"` Status string `json:"status"` PassThrough bool `json:"-"` Response []byte `json:"-"` Error error `json:"-"` ResponseGUID string `json:"-"` }
CNSIRequest
type ConnectedEndpoint ¶
type ConnectedEndpoint struct { GUID string `json:"guid"` Name string `json:"name"` CNSIType string `json:"cnsi_type"` APIEndpoint *url.URL `json:"api_endpoint"` Account string `json:"account"` TokenExpiry int64 `json:"token_expiry"` DopplerLoggingEndpoint string `json:"-"` SkipSSLValidation bool `json:"skip_ssl_validation"` TokenMetadata string `json:"-"` }
ConnectedEndpoint
type ConnectedUser ¶
type ConnectedUser struct { GUID string `json:"guid"` Name string `json:"name"` Admin bool `json:"admin"` Scopes []string `json:"scopes"` }
ConnectedUser - details about the user connected to a specific service or UAA
type ConsoleConfig ¶
type ConsoleConfig struct { UAAEndpoint *url.URL `json:"uaa_endpoint"` ConsoleAdminScope string `json:"console_admin_scope"` ConsoleClient string `json:"console_client"` ConsoleClientSecret string `json:"console_client_secret"` SkipSSLValidation bool `json:"skip_ssl_validation"` IsSetupComplete bool `json:"is_setup_complete"` }
type EndpointDetail ¶
type EndpointDetail struct { *CNSIRecord User *ConnectedUser `json:"user"` Metadata map[string]string `json:"metadata,omitempty"` TokenMetadata string `json:"-"` }
Extends CNSI Record and adds the user
type EndpointPlugin ¶
type EndpointPlugin interface { Info(apiEndpoint string, skipSSLValidation bool) (CNSIRecord, interface{}, error) GetType() string GetClientId() string Register(echoContext echo.Context) error Connect(echoContext echo.Context, cnsiRecord CNSIRecord, userId string) (*TokenRecord, bool, error) UpdateMetadata(info *Info, userGUID string, echoContext echo.Context) }
type EndpointTokenRecord ¶
type EndpointTokenRecord struct { *TokenRecord EndpointGUID string EndpointType string APIEndpint string LoggingEndpoint string }
Token record for an endpoint (includes the Endpoint GUID)
type ErrHTTPRequest ¶
func (ErrHTTPRequest) Error ¶
func (e ErrHTTPRequest) Error() string
type ErrHTTPShadow ¶
func (ErrHTTPShadow) Error ¶
func (e ErrHTTPShadow) Error() string
type Info ¶
type Info struct { Versions *Versions `json:"version"` User *ConnectedUser `json:"user"` Endpoints map[string]map[string]*EndpointDetail `json:"endpoints"` CloudFoundry *CFInfo `json:"cloud-foundry,omitempty"` PluginConfig map[string]string `json:"plugin-config,omitempty"` }
Info - this represents user specific info
type InfoFunc ¶
type InfoFunc func(apiEndpoint string, skipSSLValidation bool) (CNSIRecord, interface{}, error)
type JWTUserTokenInfo ¶
type LoginHookFunc ¶
type MiddlewarePlugin ¶
type MiddlewarePlugin interface { EchoMiddleware(middleware echo.HandlerFunc) echo.HandlerFunc SessionEchoMiddleware(middleware echo.HandlerFunc) echo.HandlerFunc }
type OAuth2Metadata ¶
Structure for optional metadata for an OAuth2 Token
type PortalConfig ¶
type PortalConfig struct { HTTPClientTimeoutInSecs int64 `configName:"HTTP_CLIENT_TIMEOUT_IN_SECS"` HTTPConnectionTimeoutInSecs int64 `configName:"HTTP_CONNECTION_TIMEOUT_IN_SECS"` TLSAddress string `configName:"CONSOLE_PROXY_TLS_ADDRESS"` TLSCert string `configName:"CONSOLE_PROXY_CERT"` TLSCertKey string `configName:"CONSOLE_PROXY_CERT_KEY"` TLSCertPath string `configName:"CONSOLE_PROXY_CERT_PATH"` TLSCertKeyPath string `configName:"CONSOLE_PROXY_CERT_KEY_PATH"` CFClient string `configName:"CF_CLIENT"` CFClientSecret string `configName:"CF_CLIENT_SECRET"` AllowedOrigins []string `configName:"ALLOWED_ORIGINS"` SessionStoreSecret string `configName:"SESSION_STORE_SECRET"` EncryptionKeyVolume string `configName:"ENCRYPTION_KEY_VOLUME"` EncryptionKeyFilename string `configName:"ENCRYPTION_KEY_FILENAME"` EncryptionKey string `configName:"ENCRYPTION_KEY"` AutoRegisterCFUrl string `configName:"AUTO_REG_CF_URL"` CookieDomain string `configName:"COOKIE_DOMAIN"` CFAdminIdentifier string CloudFoundryInfo *CFInfo HTTPS bool EncryptionKeyInBytes []byte ConsoleVersion string IsCloudFoundry bool LoginHook LoginHookFunc SessionStore SessionStorer ConsoleConfig *ConsoleConfig PluginConfig map[string]string }
type PortalProxy ¶
type PortalProxy interface { GetHttpClient(skipSSLValidation bool) http.Client RegisterEndpoint(c echo.Context, fetchInfo InfoFunc) error DoRegisterEndpoint(cnsiName string, apiEndpoint string, skipSSLValidation bool, fetchInfo InfoFunc) (CNSIRecord, error) GetEndpointTypeSpec(typeName string) (EndpointPlugin, error) // Auth ConnectOAuth2(c echo.Context, cnsiRecord CNSIRecord) (*TokenRecord, error) InitEndpointTokenRecord(expiry int64, authTok string, refreshTok string, disconnect bool) TokenRecord // Session GetSession(c echo.Context) (*sessions.Session, error) GetSessionValue(c echo.Context, key string) (interface{}, error) GetSessionInt64Value(c echo.Context, key string) (int64, error) GetSessionStringValue(c echo.Context, key string) (string, error) SaveSession(c echo.Context, session *sessions.Session) error SaveConsoleConfig(consoleConfig *ConsoleConfig, consoleRepoInterface interface{}) error RefreshOAuthToken(skipSSLValidation bool, cnsiGUID, userGUID, client, clientSecret, tokenEndpoint string) (t TokenRecord, err error) DoLoginToCNSI(c echo.Context, cnsiGUID string) (*LoginRes, error) // Expose internal portal proxy records to extensions GetCNSIRecord(guid string) (CNSIRecord, error) GetCNSIRecordByEndpoint(endpoint string) (CNSIRecord, error) GetCNSITokenRecord(cnsiGUID string, userGUID string) (TokenRecord, bool) GetCNSITokenRecordWithDisconnected(cnsiGUID string, userGUID string) (TokenRecord, bool) GetCNSIUser(cnsiGUID string, userGUID string) (*ConnectedUser, bool) GetConfig() *PortalConfig ListEndpointsByUser(userGUID string) ([]*ConnectedEndpoint, error) GetClientId(cnsiType string) (string, error) // UAA Token GetUAATokenRecord(userGUID string) (TokenRecord, error) RefreshUAAToken(userGUID string) (TokenRecord, error) GetUsername(userid string) (string, error) RefreshUAALogin(username, password string, store bool) error GetUserTokenInfo(tok string) (u *JWTUserTokenInfo, err error) // Proxy API requests ProxyRequest(c echo.Context, uri *url.URL) (map[string]*CNSIRequest, error) DoProxyRequest(requests []ProxyRequestInfo) (map[string]*CNSIRequest, error) SendProxiedResponse(c echo.Context, responses map[string]*CNSIRequest) error }
type ProxyRequestInfo ¶
type RoutePlugin ¶
type SessionStorer ¶
type StratosPlugin ¶
type StratosPlugin interface { Init() error GetMiddlewarePlugin() (MiddlewarePlugin, error) GetEndpointPlugin() (EndpointPlugin, error) GetRoutePlugin() (RoutePlugin, error) }
type TokenRecord ¶
type TokenRecord struct { AuthToken string RefreshToken string TokenExpiry int64 Disconnected bool AuthType string Metadata string }
TODO this could be moved back to tokens subpackage, and extensions could import it?
type V2Info ¶
type V2Info struct { AuthorizationEndpoint string `json:"authorization_endpoint"` TokenEndpoint string `json:"token_endpoint"` DopplerLoggingEndpoint string `json:"doppler_logging_endpoint"` AppSSHEndpoint string `json:"app_ssh_endpoint"` AppSSHHostKeyFingerprint string `json:"app_ssh_host_key_fingerprint"` AppSSHOauthCLient string `json:"app_ssh_oauth_client"` }
type VCapApplicationData ¶
Click to show internal directories.
Click to hide internal directories.