Class SecureSettings

java.lang.Object
ch.tocco.nice2.web.core.api.auth.SecureSettings

@Component public class SecureSettings extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    SecureSettings(RunEnvironmentService runEnvironmentService, boolean neverRequireSecureConnection)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    checkSecuredConnection(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)
    Checks the request whether it originates from a secure connection.
    static boolean
    isSecure(jakarta.servlet.http.HttpServletRequest req)
    Checks whether the request reached this servlet using a secure connection.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SecureSettings

      public SecureSettings(RunEnvironmentService runEnvironmentService, @Value("${nice2.web.core.neverRequireSecureConnection}") boolean neverRequireSecureConnection)
  • Method Details

    • checkSecuredConnection

      public void checkSecuredConnection(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws SendErrorException, IOException
      Checks the request whether it originates from a secure connection. If not and it has been defined as required (the default), an HTTP 400 (bad request) error is sent as response. If the request originates from a secure connection or this is configured to be not required, this method is a noop.
      Throws:
      SendErrorException
      IOException
    • isSecure

      public static boolean isSecure(jakarta.servlet.http.HttpServletRequest req)
      Checks whether the request reached this servlet using a secure connection.