MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / Authenticator

Method Authenticator

db/database.go:881–907  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

879}
880
881func (context *DatabaseContext) Authenticator(ctx context.Context) *auth.Authenticator {
882 context.BucketLock.RLock()
883 defer context.BucketLock.RUnlock()
884
885 sessionCookieName := auth.DefaultCookieName
886 if context.Options.SessionCookieName != "" {
887 sessionCookieName = context.Options.SessionCookieName
888 }
889
890 var channelsWarningThreshold *uint32
891 if context.Options.UnsupportedOptions != nil && context.Options.UnsupportedOptions.WarningThresholds != nil {
892 channelsWarningThreshold = context.Options.UnsupportedOptions.WarningThresholds.ChannelsPerUser
893 }
894
895 // Authenticators are lightweight & stateless, so it's OK to return a new one every time
896 authenticator := auth.NewAuthenticator(context.MetadataStore, context, auth.AuthenticatorOptions{
897 ClientPartitionWindow: context.Options.ClientPartitionWindow,
898 ChannelsWarningThreshold: channelsWarningThreshold,
899 SessionCookieName: sessionCookieName,
900 BcryptCost: context.Options.BcryptCost,
901 LogCtx: ctx,
902 Collections: context.CollectionNames,
903 MetaKeys: context.MetadataKeys,
904 })
905
906 return authenticator
907}
908
909// UseLegacySyncDocsIndex returns true there is an index over all docs starting with _sync, or if there are individual indexes for users and roles.
910func (context *DatabaseContext) UseLegacySyncDocsIndex() bool {

Callers 15

invalUserChannelsMethod · 0.95
invalRoleChannelsMethod · 0.95
invalUserRolesMethod · 0.95
DeleteRoleMethod · 0.95
UpdatePrincipalMethod · 0.95
GetPrincipalForTestMethod · 0.95
updatePrincipalMethod · 0.45
deleteUserMethod · 0.45
getUserInfoMethod · 0.45

Calls 3

NewAuthenticatorFunction · 0.92
RLockMethod · 0.80
RUnlockMethod · 0.80

Tested by 15

TestReloadUserFunction · 0.36
TestSessionExtensionFunction · 0.36
TestNumAccessErrorsFunction · 0.36
TestChannelAccessChangesFunction · 0.36
TestAccessOnTombstoneFunction · 0.36
TestDynamicChannelGrantFunction · 0.36
TestPublicChannelFunction · 0.36