Documentation ¶
Index ¶
- Constants
- func AccessError(msg string, err error, opts ...authErrorOption) error
- func GetSupportedOauth2TokenExchangeJwtAlgorithms() []string
- func IsAccessError(err error) bool
- func NewFixedTokenSource(token, tokenType string) *fixedTokenSource
- func NewJWTTokenSource(opts ...JWTTokenSourceOption) (*jwtTokenSource, error)
- func NewOauth2TokenExchangeCredentials(opts ...Oauth2TokenExchangeCredentialsOption) (*oauth2TokenExchange, error)
- func NewOauth2TokenExchangeCredentialsFile(configFilePath string, opts ...Oauth2TokenExchangeCredentialsOption) (*oauth2TokenExchange, error)
- func WithActorToken(actorToken TokenSource) *tokenSourceOption
- func WithAddress(address string) addressAuthErrorOption
- func WithAudience(audience string, audiences ...string) audienceOption
- func WithCredentials(credentials Credentials) credentialsUnauthenticatedErrorOption
- func WithDatabase(database string) databaseAuthErrorOption
- func WithECPrivateKeyPEMContent(key []byte) *ecPrivateKeyPemContentOption
- func WithECPrivateKeyPEMFile(path string) *ecPrivateKeyPemFileOption
- func WithEndpoint(endpoint string) endpointAuthErrorOption
- func WithFixedActorToken(token, tokenType string) *tokenSourceOption
- func WithFixedSubjectToken(token, tokenType string) *tokenSourceOption
- func WithGrantType(grantType string) grantTypeOption
- func WithGrpcDialOptions(opts ...grpc.DialOption) grpcDialOptionsOption
- func WithHMACSecretKey(key []byte) *hmacSecretKeyContentOption
- func WithHMACSecretKeyBase64Content(base64KeyContent string) *hmacSecretKeyBase64ContentOption
- func WithHMACSecretKeyBase64File(path string) *hmacSecretKeyBase64FileOption
- func WithHMACSecretKeyFile(path string) *hmacSecretKeyFileOption
- func WithID(id string) idOption
- func WithIssuer(issuer string) issuerOption
- func WithJWTActorToken(opts ...JWTTokenSourceOption) *tokenSourceOption
- func WithJWTSubjectToken(opts ...JWTTokenSourceOption) *tokenSourceOption
- func WithKeyID(id string) keyIDOption
- func WithNodeID(id uint32) authErrorOption
- func WithPrivateKey(key interface{}) *privateKeyOption
- func WithRSAPrivateKeyPEMContent(key []byte) *rsaPrivateKeyPemContentOption
- func WithRSAPrivateKeyPEMFile(path string) *rsaPrivateKeyPemFileOption
- func WithRequestTimeout(timeout time.Duration) requestTimeoutOption
- func WithRequestedTokenType(requestedTokenType string) requestedTokenTypeOption
- func WithResource(resource string, resources ...string) resourceOption
- func WithScope(scope string, scopes ...string) scopeOption
- func WithSigningMethod(method jwt.SigningMethod) *signingMethodOption
- func WithSigningMethodName(method string) *signingMethodNameOption
- func WithSubject(subject string) subjectOption
- func WithSubjectToken(subjectToken TokenSource) *tokenSourceOption
- func WithSyncExchangeTimeout(timeout time.Duration) syncExchangeTimeoutOption
- func WithTokenEndpoint(endpoint string) tokenEndpointOption
- func WithTokenTTL(ttl time.Duration) tokenTTLOption
- type AccessToken
- type AccessTokenCredentialsOption
- type Anonymous
- type AnonymousCredentialsOption
- type Credentials
- type JWTTokenSourceOption
- type Oauth2TokenExchangeCredentialsOption
- type SourceInfoOption
- func (sourceInfo SourceInfoOption) ApplyAccessTokenCredentialsOption(h *AccessToken)
- func (sourceInfo SourceInfoOption) ApplyAnonymousCredentialsOption(h *Anonymous)
- func (sourceInfo SourceInfoOption) ApplyOauth2CredentialsOption(h *oauth2TokenExchange) error
- func (sourceInfo SourceInfoOption) ApplyStaticCredentialsOption(h *Static)
- type Static
- type StaticCredentialsOption
- type Token
- type TokenSource
Constants ¶
View Source
const ( SubjectTokenSourceType = 1 ActorTokenSourceType = 2 )
View Source
const TokenRefreshDivisor = 10
Variables ¶
This section is empty.
Functions ¶
func AccessError ¶
func GetSupportedOauth2TokenExchangeJwtAlgorithms ¶
func GetSupportedOauth2TokenExchangeJwtAlgorithms() []string
func IsAccessError ¶
func NewFixedTokenSource ¶
func NewFixedTokenSource(token, tokenType string) *fixedTokenSource
func NewJWTTokenSource ¶
func NewJWTTokenSource(opts ...JWTTokenSourceOption) (*jwtTokenSource, error)
func NewOauth2TokenExchangeCredentials ¶
func NewOauth2TokenExchangeCredentials( opts ...Oauth2TokenExchangeCredentialsOption, ) (*oauth2TokenExchange, error)
func NewOauth2TokenExchangeCredentialsFile ¶
func NewOauth2TokenExchangeCredentialsFile( configFilePath string, opts ...Oauth2TokenExchangeCredentialsOption, ) (*oauth2TokenExchange, error)
func WithActorToken ¶
func WithActorToken(actorToken TokenSource) *tokenSourceOption
ActorTokenSource
func WithAddress ¶
func WithAddress(address string) addressAuthErrorOption
func WithAudience ¶
func WithCredentials ¶
func WithCredentials(credentials Credentials) credentialsUnauthenticatedErrorOption
func WithDatabase ¶
func WithDatabase(database string) databaseAuthErrorOption
func WithECPrivateKeyPEMContent ¶
func WithECPrivateKeyPEMContent(key []byte) *ecPrivateKeyPemContentOption
func WithECPrivateKeyPEMFile ¶
func WithECPrivateKeyPEMFile(path string) *ecPrivateKeyPemFileOption
func WithEndpoint ¶
func WithEndpoint(endpoint string) endpointAuthErrorOption
func WithFixedActorToken ¶
func WithFixedActorToken(token, tokenType string) *tokenSourceOption
func WithFixedSubjectToken ¶
func WithFixedSubjectToken(token, tokenType string) *tokenSourceOption
func WithGrantType ¶
func WithGrantType(grantType string) grantTypeOption
func WithGrpcDialOptions ¶
func WithGrpcDialOptions(opts ...grpc.DialOption) grpcDialOptionsOption
func WithHMACSecretKey ¶
func WithHMACSecretKey(key []byte) *hmacSecretKeyContentOption
func WithHMACSecretKeyBase64Content ¶
func WithHMACSecretKeyBase64Content(base64KeyContent string) *hmacSecretKeyBase64ContentOption
func WithHMACSecretKeyBase64File ¶
func WithHMACSecretKeyBase64File(path string) *hmacSecretKeyBase64FileOption
func WithHMACSecretKeyFile ¶
func WithHMACSecretKeyFile(path string) *hmacSecretKeyFileOption
func WithIssuer ¶
func WithIssuer(issuer string) issuerOption
func WithJWTActorToken ¶
func WithJWTActorToken(opts ...JWTTokenSourceOption) *tokenSourceOption
func WithJWTSubjectToken ¶
func WithJWTSubjectToken(opts ...JWTTokenSourceOption) *tokenSourceOption
func WithNodeID ¶
func WithNodeID(id uint32) authErrorOption
func WithPrivateKey ¶
func WithPrivateKey(key interface{}) *privateKeyOption
func WithRSAPrivateKeyPEMContent ¶
func WithRSAPrivateKeyPEMContent(key []byte) *rsaPrivateKeyPemContentOption
func WithRSAPrivateKeyPEMFile ¶
func WithRSAPrivateKeyPEMFile(path string) *rsaPrivateKeyPemFileOption
func WithRequestTimeout ¶
func WithRequestedTokenType ¶
func WithRequestedTokenType(requestedTokenType string) requestedTokenTypeOption
func WithResource ¶
func WithSigningMethod ¶
func WithSigningMethod(method jwt.SigningMethod) *signingMethodOption
func WithSigningMethodName ¶
func WithSigningMethodName(method string) *signingMethodNameOption
func WithSubject ¶
func WithSubject(subject string) subjectOption
func WithSubjectToken ¶
func WithSubjectToken(subjectToken TokenSource) *tokenSourceOption
func WithSyncExchangeTimeout ¶
func WithTokenEndpoint ¶
func WithTokenEndpoint(endpoint string) tokenEndpointOption
func WithTokenTTL ¶
Types ¶
type AccessToken ¶
type AccessToken struct {
// contains filtered or unexported fields
}
AccessToken implements Credentials interface with static authorization parameters.
func NewAccessTokenCredentials ¶
func NewAccessTokenCredentials(token string, opts ...AccessTokenCredentialsOption) *AccessToken
type AccessTokenCredentialsOption ¶
type AccessTokenCredentialsOption interface {
ApplyAccessTokenCredentialsOption(c *AccessToken)
}
type Anonymous ¶
type Anonymous struct {
// contains filtered or unexported fields
}
Anonymous implements Credentials interface with Anonymous access
func NewAnonymousCredentials ¶
func NewAnonymousCredentials(opts ...AnonymousCredentialsOption) *Anonymous
type AnonymousCredentialsOption ¶
type AnonymousCredentialsOption interface {
ApplyAnonymousCredentialsOption(c *Anonymous)
}
type Credentials ¶
type Credentials interface { // Token must return actual token or error Token(ctx context.Context) (string, error) }
Credentials is an interface of YDB credentials required for connect with YDB
type JWTTokenSourceOption ¶
type JWTTokenSourceOption interface {
ApplyJWTTokenSourceOption(s *jwtTokenSource) error
}
type Oauth2TokenExchangeCredentialsOption ¶
type Oauth2TokenExchangeCredentialsOption interface {
ApplyOauth2CredentialsOption(c *oauth2TokenExchange) error
}
type SourceInfoOption ¶
type SourceInfoOption string
func WithSourceInfo ¶
func WithSourceInfo(sourceInfo string) SourceInfoOption
WithSourceInfo option append to credentials object the source info for reporting source info details on error case
func (SourceInfoOption) ApplyAccessTokenCredentialsOption ¶
func (sourceInfo SourceInfoOption) ApplyAccessTokenCredentialsOption(h *AccessToken)
func (SourceInfoOption) ApplyAnonymousCredentialsOption ¶
func (sourceInfo SourceInfoOption) ApplyAnonymousCredentialsOption(h *Anonymous)
func (SourceInfoOption) ApplyOauth2CredentialsOption ¶
func (sourceInfo SourceInfoOption) ApplyOauth2CredentialsOption(h *oauth2TokenExchange) error
func (SourceInfoOption) ApplyStaticCredentialsOption ¶
func (sourceInfo SourceInfoOption) ApplyStaticCredentialsOption(h *Static)
type Static ¶
type Static struct {
// contains filtered or unexported fields
}
Static implements Credentials interface with static authorization parameters.
func NewStaticCredentials ¶
func NewStaticCredentials(user, password, endpoint string, opts ...StaticCredentialsOption) *Static
type StaticCredentialsOption ¶
type StaticCredentialsOption interface {
ApplyStaticCredentialsOption(c *Static)
}
type Token ¶
type Token struct { Token string // token type according to OAuth 2.0 token exchange protocol // https://www.rfc-editor.org/rfc/rfc8693#TokenTypeIdentifiers // for example urn:ietf:params:oauth:token-type:jwt TokenType string }
type TokenSource ¶
Click to show internal directories.
Click to hide internal directories.