Class BasicAuthHttpServiceFilter.Builder<UserInfo>
- Type Parameters:
UserInfo- a type for authenticated user info object
- Enclosing class:
- BasicAuthHttpServiceFilter<UserInfo>
StreamingHttpServiceFilter, which filters HTTP requests using RFC7617: The 'Basic' HTTP Authentication Scheme.-
Constructor Summary
ConstructorsConstructorDescriptionBuilder(BasicAuthHttpServiceFilter.CredentialsVerifier<UserInfo> credentialsVerifier, String realm) Creates a new builder for anStreamingHttpServiceFilter, which filters HTTP requests using RFC7617: The 'Basic' HTTP Authentication Scheme. -
Method Summary
Modifier and TypeMethodDescriptionCreates a new instance for proxy service.Creates a new instance for non-proxy service.setCharsetUtf8(boolean utf8) Sets an advice for a user agent to useUTF-8charset when it generatesuser-id:passwordpair.userInfoAsyncContextKey(ContextMap.Key<UserInfo> userInfoAsyncContextKey) Sets akeyto store a user info object of authenticated user inAsyncContext.userInfoRequestContextKey(ContextMap.Key<UserInfo> userInfoRequestContextKey) Sets akeyto store a user info object of authenticated user inrequest context.
-
Constructor Details
-
Builder
public Builder(BasicAuthHttpServiceFilter.CredentialsVerifier<UserInfo> credentialsVerifier, String realm) Creates a new builder for anStreamingHttpServiceFilter, which filters HTTP requests using RFC7617: The 'Basic' HTTP Authentication Scheme.It accepts credentials as
user-id:passwordpairs, encoded usingBase64forAuthorizationorProxy-Authorizationheader values. Use of the formatuser:passwordin theuserinfofield is deprecated by RFC3986.User info object of authenticated user can be stored in
AsyncContextifContextMap.Keyis configured viauserInfoAsyncContextKey(ContextMap.Key)orrequest contextifContextMap.Keyis configured viauserInfoRequestContextKey(ContextMap.Key). The samekeycan be reused for both context storages.Note: This scheme is not considered to be a secure method of user authentication unless used in conjunction with some external secure system such as TLS (Transport Layer Security, [RFC5246]), as the
user-idandpasswordare passed over the network as cleartext.- Parameters:
credentialsVerifier- aBasicAuthHttpServiceFilter.CredentialsVerifierforuser-idandpasswordspairrealm- a protection space (realm)
-
-
Method Details
-
userInfoAsyncContextKey
public BasicAuthHttpServiceFilter.Builder<UserInfo> userInfoAsyncContextKey(ContextMap.Key<UserInfo> userInfoAsyncContextKey) Sets akeyto store a user info object of authenticated user inAsyncContext.- Parameters:
userInfoAsyncContextKey- a key to store a user info object inAsyncContext- Returns:
this
-
userInfoRequestContextKey
public BasicAuthHttpServiceFilter.Builder<UserInfo> userInfoRequestContextKey(ContextMap.Key<UserInfo> userInfoRequestContextKey) Sets akeyto store a user info object of authenticated user inrequest context.- Parameters:
userInfoRequestContextKey- a key to store a user info object inrequest context- Returns:
this
-
setCharsetUtf8
Sets an advice for a user agent to useUTF-8charset when it generatesuser-id:passwordpair.It will result in adding an optional charset="UTF-8" parameter for an authenticate header.
- Parameters:
utf8- iftrue, an optionalcharset="UTF-8"parameter will be added for an authenticate header- Returns:
this
-
buildServer
Creates a new instance for non-proxy service.It will use the following constants to handle authentication:
Response status code, authenticate and authorization headers for non-proxy Basic auth Response status code 401 (Unauthorized) Authenticate header WWW-Authenticate Authorization header Authorization - Returns:
- a new
BasicAuthHttpServiceFilter.Builder
-
buildProxy
Creates a new instance for proxy service.It will use the following constants to handle authentication:
Response status code, authenticate and authorization headers for proxy Basic auth Response status code 407 (Proxy Authentication Required) Authenticate header Proxy-Authenticate Authorization header Proxy-Authorization - Returns:
- a new
StreamingHttpServiceFilterFactory
-