Class AuthenticationTemplate<A extends org.springframework.security.core.Authentication>
java.lang.Object
org.bremersee.spring.security.core.AuthenticationTemplate<A>
- All Implemented Interfaces:
AuthenticationOperations<A>
public class AuthenticationTemplate<A extends org.springframework.security.core.Authentication>
extends Object
implements AuthenticationOperations<A>
The authentication template.
- Author:
- Christian Bremer
-
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a new authentication template.AuthenticationTemplate(Supplier<ServiceException> unauthenticatedExceptionSupplier) Instantiates a new authentication template. -
Method Summary
Modifier and TypeMethodDescription<R> RdoWithAuthentication(@NonNull Function<A, R> function) Do with authentication.<R> RdoWithOptionalAuthentication(@NonNull Function<@Nullable A, R> function) Do with optional authentication r.<R> @NonNull org.springframework.http.ResponseEntity<R> responseWithAuthentication(@NonNull Function<A, R> function) Response with authentication.<R> @NonNull org.springframework.http.ResponseEntity<R> responseWithOptionalAuthentication(@NonNull Function<@Nullable A, R> function) Response with optional authentication response entity.
-
Constructor Details
-
AuthenticationTemplate
public AuthenticationTemplate()Instantiates a new authentication template. -
AuthenticationTemplate
Instantiates a new authentication template.- Parameters:
unauthenticatedExceptionSupplier- the unauthenticated exception supplier
-
-
Method Details
-
doWithAuthentication
Description copied from interface:AuthenticationOperationsDo with authentication.- Specified by:
doWithAuthenticationin interfaceAuthenticationOperations<A extends org.springframework.security.core.Authentication>- Type Parameters:
R- the type parameter- Parameters:
function- the function- Returns:
- the r
-
doWithOptionalAuthentication
Description copied from interface:AuthenticationOperationsDo with optional authentication r.- Specified by:
doWithOptionalAuthenticationin interfaceAuthenticationOperations<A extends org.springframework.security.core.Authentication>- Type Parameters:
R- the type parameter- Parameters:
function- the function- Returns:
- the r
-
responseWithAuthentication
public <R> @NonNull org.springframework.http.ResponseEntity<R> responseWithAuthentication(@NonNull Function<A, R> function) Description copied from interface:AuthenticationOperationsResponse with authentication.- Specified by:
responseWithAuthenticationin interfaceAuthenticationOperations<A extends org.springframework.security.core.Authentication>- Type Parameters:
R- the type parameter- Parameters:
function- the function- Returns:
- the response entity
-
responseWithOptionalAuthentication
public <R> @NonNull org.springframework.http.ResponseEntity<R> responseWithOptionalAuthentication(@NonNull Function<@Nullable A, R> function) Description copied from interface:AuthenticationOperationsResponse with optional authentication response entity.- Specified by:
responseWithOptionalAuthenticationin interfaceAuthenticationOperations<A extends org.springframework.security.core.Authentication>- Type Parameters:
R- the type parameter- Parameters:
function- the function- Returns:
- the response entity
-