Documentation ¶
Index ¶
- Constants
- func AccessError(msg string, err error, opts ...authErrorOption) error
- func IsAccessError(err error) bool
- func NewFixedTokenSource(token, tokenType string) *fixedTokenSource
- func NewJWTTokenSource(opts ...JWTTokenSourceOption) (*jwtTokenSource, error)
- func NewOauth2TokenExchangeCredentials(opts ...Oauth2TokenExchangeCredentialsOption) (*oauth2TokenExchange, error)
- func WithActorToken(actorToken TokenSource) *tokenSourceOption
- func WithAddress(address string) addressAuthErrorOption
- func WithAudience(audience ...string) audienceOption
- func WithCredentials(credentials Credentials) credentialsUnauthenticatedErrorOption
- func WithDatabase(database string) databaseAuthErrorOption
- 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 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) resourceOption
- func WithScope(scope ...string) scopeOption
- func WithSigningMethod(method jwt.SigningMethod) *signingMethodOption
- func WithSubject(subject string) subjectOption
- func WithSubjectToken(subjectToken TokenSource) *tokenSourceOption
- 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 ¶ added in v3.54.0
func IsAccessError ¶ added in v3.54.0
func NewFixedTokenSource ¶ added in v3.65.0
func NewFixedTokenSource(token, tokenType string) *fixedTokenSource
func NewJWTTokenSource ¶ added in v3.65.0
func NewJWTTokenSource(opts ...JWTTokenSourceOption) (*jwtTokenSource, error)
func NewOauth2TokenExchangeCredentials ¶ added in v3.65.0
func NewOauth2TokenExchangeCredentials( opts ...Oauth2TokenExchangeCredentialsOption, ) (*oauth2TokenExchange, error)
func WithActorToken ¶ added in v3.65.0
func WithActorToken(actorToken TokenSource) *tokenSourceOption
ActorTokenSource
func WithAddress ¶ added in v3.53.3
func WithAddress(address string) addressAuthErrorOption
func WithAudience ¶ added in v3.65.0
func WithAudience(audience ...string) audienceOption
func WithCredentials ¶ added in v3.53.3
func WithCredentials(credentials Credentials) credentialsUnauthenticatedErrorOption
func WithDatabase ¶ added in v3.53.3
func WithDatabase(database string) databaseAuthErrorOption
func WithEndpoint ¶ added in v3.53.3
func WithEndpoint(endpoint string) endpointAuthErrorOption
func WithFixedActorToken ¶ added in v3.65.0
func WithFixedActorToken(token, tokenType string) *tokenSourceOption
func WithFixedSubjectToken ¶ added in v3.65.0
func WithFixedSubjectToken(token, tokenType string) *tokenSourceOption
func WithGrantType ¶ added in v3.65.0
func WithGrantType(grantType string) grantTypeOption
func WithGrpcDialOptions ¶ added in v3.53.3
func WithGrpcDialOptions(opts ...grpc.DialOption) grpcDialOptionsOption
func WithIssuer ¶ added in v3.65.0
func WithIssuer(issuer string) issuerOption
func WithJWTActorToken ¶ added in v3.65.0
func WithJWTActorToken(opts ...JWTTokenSourceOption) *tokenSourceOption
func WithJWTSubjectToken ¶ added in v3.65.0
func WithJWTSubjectToken(opts ...JWTTokenSourceOption) *tokenSourceOption
func WithNodeID ¶ added in v3.53.3
func WithNodeID(id uint32) authErrorOption
func WithPrivateKey ¶ added in v3.65.0
func WithPrivateKey(key interface{}) *privateKeyOption
func WithRSAPrivateKeyPEMContent ¶ added in v3.65.0
func WithRSAPrivateKeyPEMContent(key []byte) *rsaPrivateKeyPemContentOption
func WithRSAPrivateKeyPEMFile ¶ added in v3.65.0
func WithRSAPrivateKeyPEMFile(path string) *rsaPrivateKeyPemFileOption
func WithRequestTimeout ¶ added in v3.65.0
func WithRequestedTokenType ¶ added in v3.65.0
func WithRequestedTokenType(requestedTokenType string) requestedTokenTypeOption
func WithResource ¶ added in v3.65.0
func WithResource(resource string) resourceOption
func WithSigningMethod ¶ added in v3.65.0
func WithSigningMethod(method jwt.SigningMethod) *signingMethodOption
func WithSubject ¶ added in v3.65.0
func WithSubject(subject string) subjectOption
func WithSubjectToken ¶ added in v3.65.0
func WithSubjectToken(subjectToken TokenSource) *tokenSourceOption
func WithTokenEndpoint ¶ added in v3.65.0
func WithTokenEndpoint(endpoint string) tokenEndpointOption
func WithTokenTTL ¶ added in v3.65.0
Types ¶
type AccessToken ¶ added in v3.48.5
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
func (AccessToken) String ¶ added in v3.48.5
func (c AccessToken) String() string
Token implements Credentials.
type AccessTokenCredentialsOption ¶ added in v3.53.3
type AccessTokenCredentialsOption interface {
ApplyAccessTokenCredentialsOption(c *AccessToken)
}
type Anonymous ¶ added in v3.48.5
type Anonymous struct {
// contains filtered or unexported fields
}
Anonymous implements Credentials interface with Anonymous access
func NewAnonymousCredentials ¶
func NewAnonymousCredentials(opts ...AnonymousCredentialsOption) *Anonymous
type AnonymousCredentialsOption ¶ added in v3.53.3
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 ¶ added in v3.65.0
type JWTTokenSourceOption interface {
ApplyJWTTokenSourceOption(s *jwtTokenSource) error
}
type Oauth2TokenExchangeCredentialsOption ¶ added in v3.65.0
type Oauth2TokenExchangeCredentialsOption interface {
ApplyOauth2CredentialsOption(c *oauth2TokenExchange) error
}
type SourceInfoOption ¶ added in v3.53.3
type SourceInfoOption string
func WithSourceInfo ¶ added in v3.48.5
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 ¶ added in v3.53.3
func (sourceInfo SourceInfoOption) ApplyAccessTokenCredentialsOption(h *AccessToken)
func (SourceInfoOption) ApplyAnonymousCredentialsOption ¶ added in v3.53.3
func (sourceInfo SourceInfoOption) ApplyAnonymousCredentialsOption(h *Anonymous)
func (SourceInfoOption) ApplyOauth2CredentialsOption ¶ added in v3.65.0
func (sourceInfo SourceInfoOption) ApplyOauth2CredentialsOption(h *oauth2TokenExchange) error
func (SourceInfoOption) ApplyStaticCredentialsOption ¶ added in v3.53.3
func (sourceInfo SourceInfoOption) ApplyStaticCredentialsOption(h *Static)
type Static ¶ added in v3.48.5
type Static struct {
// contains filtered or unexported fields
}
Static implements Credentials interface with static authorization parameters.
func NewStaticCredentials ¶ added in v3.34.0
func NewStaticCredentials(user, password, endpoint string, opts ...StaticCredentialsOption) *Static
type StaticCredentialsOption ¶ added in v3.53.3
type StaticCredentialsOption interface {
ApplyStaticCredentialsOption(c *Static)
}
type Token ¶ added in v3.65.0
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 ¶ added in v3.65.0
Click to show internal directories.
Click to hide internal directories.