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

Method BuildProvider

auth/jwt.go:168–186  ·  view source on GitHub ↗

BuildProvider prepares a LocalJWTAuthProvider from this config, initialising keySet.

(ctx context.Context, name string)

Source from the content-addressed store, hash-verified

166
167// BuildProvider prepares a LocalJWTAuthProvider from this config, initialising keySet.
168func (l LocalJWTAuthConfig) BuildProvider(ctx context.Context, name string) *LocalJWTAuthProvider {
169 var prov *LocalJWTAuthProvider
170 // validation ensures these are truly mutually exclusive
171 if len(l.Keys) > 0 {
172 prov = &LocalJWTAuthProvider{
173 LocalJWTAuthConfig: l,
174 name: name,
175 keySet: l.Keys,
176 }
177 } else {
178 prov = &LocalJWTAuthProvider{
179 LocalJWTAuthConfig: l,
180 name: name,
181 keySet: oidc.NewRemoteKeySet(ctx, l.JWKSURI),
182 }
183 }
184 prov.initUserPrefix(ctx)
185 return prov
186}
187
188type LocalJWTAuthProvider struct {
189 LocalJWTAuthConfig

Callers 2

TestJWTVerifyTokenFunction · 0.80
StartOnlineProcessesMethod · 0.80

Calls 1

initUserPrefixMethod · 0.95

Tested by 1

TestJWTVerifyTokenFunction · 0.64