Module org.refcodes.web
Package org.refcodes.web
Interface AuthTypeCredentials<T extends AuthTypeCredentials<T,V>,V extends org.refcodes.mixin.Validatable<V>>
- Type Parameters:
T
- The implementing type to be e.g. returned by according builder methods and Super-Type of V.V
- The lest common super-type of T which can be used to validate credentials.
- All Superinterfaces:
AuthTypeAccessor
,org.refcodes.mixin.Validatable<V>
- All Known Implementing Classes:
BasicAuthCredentials
,BasicAuthCredentialsBuilder
,BearerAuthCredentials
public interface AuthTypeCredentials<T extends AuthTypeCredentials<T,V>,V extends org.refcodes.mixin.Validatable<V>>
extends org.refcodes.mixin.Validatable<V>, AuthTypeAccessor
The Interface AuthTypeCredentials.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.web.AuthTypeAccessor
AuthTypeAccessor.AuthTypeBuilder<B extends AuthTypeAccessor.AuthTypeBuilder<B>>, AuthTypeAccessor.AuthTypeMutator, AuthTypeAccessor.AuthTypeProperty
-
Method Summary
Modifier and TypeMethodDescriptionvoid
fromHttpAuthorization
(String aHttpAuthorization) Initializes thisAuthTypeCredentials
instance from theHeaderField.AUTHORIZATION
Header-Fields's value.Creates aHeaderField.AUTHORIZATION
HTTP Header-Field value from theAuthTypeCredentials
instance.void
Validates the providedBasicCredentials
with thisBasicAuthCredentials
viaValidatable.isValid(Object)
.withHttpAuthorization
(String aHttpAuthorization) Initializes thisAuthTypeCredentials
instance from theHeaderField.AUTHORIZATION
Header-Fields's value.Methods inherited from interface org.refcodes.web.AuthTypeAccessor
getAuthType
Methods inherited from interface org.refcodes.mixin.Validatable
isValid
-
Method Details
-
toHttpAuthorization
String toHttpAuthorization()Creates aHeaderField.AUTHORIZATION
HTTP Header-Field value from theAuthTypeCredentials
instance.- Returns:
- The according HTTP Header-Field's value.
-
fromHttpAuthorization
Initializes thisAuthTypeCredentials
instance from theHeaderField.AUTHORIZATION
Header-Fields's value.- Parameters:
aHttpAuthorization
- TheHeaderField.AUTHORIZATION
header field's value- Throws:
IllegalArgumentException
- The value does not conform the the HTTP Authorization Header-Field's Basic-Authentication format.
-
withHttpAuthorization
Initializes thisAuthTypeCredentials
instance from theHeaderField.AUTHORIZATION
Header-Fields's value.- Parameters:
aHttpAuthorization
- TheHeaderField.AUTHORIZATION
header field's value- Returns:
- the t
- Throws:
IllegalArgumentException
- The value does not conform the the HTTP Authorization Header-Field's Basic-Authentication format.
-
validate
Validates the providedBasicCredentials
with thisBasicAuthCredentials
viaValidatable.isValid(Object)
. In case the providedBasicCredentials
are not valid, then aForbiddenException
is thrown.- Parameters:
aCredentials
- TheBasicCredentials
to be verified.- Throws:
ForbiddenException
- thrown in case the providedBasicCredentials
do not match.
-