(ctx context.Context)
| 232 | } |
| 233 | |
| 234 | func (l *LocalJWTAuthProvider) initUserPrefix(ctx context.Context) { |
| 235 | if l.UserPrefix != "" || l.UsernameClaim != "" { |
| 236 | return |
| 237 | } |
| 238 | |
| 239 | issuerURL, err := url.ParseRequestURI(l.Issuer) |
| 240 | if err != nil { |
| 241 | base.WarnfCtx(ctx, "Unable to parse issuer URI when initializing user prefix - using provider name") |
| 242 | l.UserPrefix = l.name |
| 243 | return |
| 244 | } |
| 245 | l.UserPrefix = issuerURL.Host + issuerURL.Path |
| 246 | |
| 247 | // If the prefix contains forward slash or underscore, it's not valid as-is for a username: forward slash |
| 248 | // breaks the REST API, underscore breaks uniqueness of "[prefix]_[sub]". URL encode the prefix to cover |
| 249 | // this scenario |
| 250 | l.UserPrefix = url.QueryEscape(l.UserPrefix) |
| 251 | } |
| 252 | |
| 253 | type LocalJWTConfig map[string]LocalJWTAuthConfig |
| 254 | type LocalJWTProviderMap map[string]*LocalJWTAuthProvider |
no test coverage detected