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 Details

    • AuthenticationTemplate

      public AuthenticationTemplate()
      Instantiates a new authentication template.
    • AuthenticationTemplate

      public AuthenticationTemplate(Supplier<ServiceException> unauthenticatedExceptionSupplier)
      Instantiates a new authentication template.
      Parameters:
      unauthenticatedExceptionSupplier - the unauthenticated exception supplier
  • Method Details

    • doWithAuthentication

      public <R> R doWithAuthentication(@NonNull Function<A,R> function)
      Description copied from interface: AuthenticationOperations
      Do with authentication.
      Specified by:
      doWithAuthentication in interface AuthenticationOperations<A extends org.springframework.security.core.Authentication>
      Type Parameters:
      R - the type parameter
      Parameters:
      function - the function
      Returns:
      the r
    • doWithOptionalAuthentication

      public <R> R doWithOptionalAuthentication(@NonNull Function<@Nullable A,R> function)
      Description copied from interface: AuthenticationOperations
      Do with optional authentication r.
      Specified by:
      doWithOptionalAuthentication in interface AuthenticationOperations<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: AuthenticationOperations
      Response with authentication.
      Specified by:
      responseWithAuthentication in interface AuthenticationOperations<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: AuthenticationOperations
      Response with optional authentication response entity.
      Specified by:
      responseWithOptionalAuthentication in interface AuthenticationOperations<A extends org.springframework.security.core.Authentication>
      Type Parameters:
      R - the type parameter
      Parameters:
      function - the function
      Returns:
      the response entity