Record Class NrichCsrfProperties

java.lang.Object
java.lang.Record
net.croz.nrich.security.csrf.properties.NrichCsrfProperties
Record Components:
active - Whether CSRF is active.
tokenExpirationInterval - Duration of CSRF token.
tokenFutureThreshold - Duration of how long token can be in the future (can happen when server and client time is not in sync).
tokenKeyName - Name of CSRF token.
cryptoKeyLength - Length of crypto key (128, 256...).
initialTokenUrl - Initial application url (i.e. url that user is redirected after login). Token will be added to response from this url as
csrfInitialToken
parameter.
csrfPingUri - Uri used for CSRF ping request.
csrfExcludeConfigList - A list of CsrfExcludeConfig instances that contain urls or regexps excluded from CSRF check.

@ConfigurationProperties("nrich.security.csrf") public record NrichCsrfProperties(@DefaultValue("true") boolean active, @DefaultValue("35m") Duration tokenExpirationInterval, @DefaultValue("1m") Duration tokenFutureThreshold, @DefaultValue("X-CSRF-Token") String tokenKeyName, @DefaultValue("128") Integer cryptoKeyLength, String initialTokenUrl, @DefaultValue("/nrich/csrf/ping") String csrfPingUri, List<net.croz.nrich.security.csrf.core.model.CsrfExcludeConfig> csrfExcludeConfigList) extends Record
  • Constructor Details

    • NrichCsrfProperties

      public NrichCsrfProperties(@DefaultValue("true") boolean active, @DefaultValue("35m") Duration tokenExpirationInterval, @DefaultValue("1m") Duration tokenFutureThreshold, @DefaultValue("X-CSRF-Token") String tokenKeyName, @DefaultValue("128") Integer cryptoKeyLength, String initialTokenUrl, @DefaultValue("/nrich/csrf/ping") String csrfPingUri, List<net.croz.nrich.security.csrf.core.model.CsrfExcludeConfig> csrfExcludeConfigList)
      Creates an instance of a NrichCsrfProperties record class.
      Parameters:
      active - the value for the active record component
      tokenExpirationInterval - the value for the tokenExpirationInterval record component
      tokenFutureThreshold - the value for the tokenFutureThreshold record component
      tokenKeyName - the value for the tokenKeyName record component
      cryptoKeyLength - the value for the cryptoKeyLength record component
      initialTokenUrl - the value for the initialTokenUrl record component
      csrfPingUri - the value for the csrfPingUri record component
      csrfExcludeConfigList - the value for the csrfExcludeConfigList record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • active

      public boolean active()
      Returns the value of the active record component.
      Returns:
      the value of the active record component
    • tokenExpirationInterval

      public Duration tokenExpirationInterval()
      Returns the value of the tokenExpirationInterval record component.
      Returns:
      the value of the tokenExpirationInterval record component
    • tokenFutureThreshold

      public Duration tokenFutureThreshold()
      Returns the value of the tokenFutureThreshold record component.
      Returns:
      the value of the tokenFutureThreshold record component
    • tokenKeyName

      public String tokenKeyName()
      Returns the value of the tokenKeyName record component.
      Returns:
      the value of the tokenKeyName record component
    • cryptoKeyLength

      public Integer cryptoKeyLength()
      Returns the value of the cryptoKeyLength record component.
      Returns:
      the value of the cryptoKeyLength record component
    • initialTokenUrl

      public String initialTokenUrl()
      Returns the value of the initialTokenUrl record component.
      Returns:
      the value of the initialTokenUrl record component
    • csrfPingUri

      public String csrfPingUri()
      Returns the value of the csrfPingUri record component.
      Returns:
      the value of the csrfPingUri record component
    • csrfExcludeConfigList

      public List<net.croz.nrich.security.csrf.core.model.CsrfExcludeConfig> csrfExcludeConfigList()
      Returns the value of the csrfExcludeConfigList record component.
      Returns:
      the value of the csrfExcludeConfigList record component