Class JdbcPrincipalAttributesProperties

java.lang.Object
org.apereo.cas.configuration.model.support.jpa.AbstractJpaProperties
org.apereo.cas.configuration.model.support.jdbc.JdbcPrincipalAttributesProperties
All Implemented Interfaces:
Serializable

@RequiresModule(name="cas-server-support-person-directory", automated=true) public class JdbcPrincipalAttributesProperties extends AbstractJpaProperties
Since:
5.2.0
See Also:
  • Constructor Details

    • JdbcPrincipalAttributesProperties

      public JdbcPrincipalAttributesProperties()
  • Method Details

    • getSql

      public String getSql()
      The SQL statement to execute and fetch attributes. The syntax of the query must be SELECT * FROM table WHERE {0}. The WHERE clause is dynamically generated by CAS.
    • isSingleRow

      public boolean isSingleRow()
      Designed to work against a table where there is a mapping of one row to one user. The fields in the table structure is assumed to match username|name|lastname|address where there is only a single row per user. Setting this setting to false will force CAS to work against a table where there is a mapping of one row to one user. The fields in the table structure is assumed to match username|attr_name|attr_value where there is more than one row per username.
    • isRequireAllAttributes

      public boolean isRequireAllAttributes()
      If the SQL should only be run if all attributes listed in the mappings exist in the query.
    • getCaseCanonicalization

      public String getCaseCanonicalization()
      When constructing the final person object from the attribute repository, indicate how the username should be canonicalized. Accepted values are:
      • UPPER: Transform the final person id into uppercase characters.
      • LOWER: Transform the final person id into lowercase characters.
      • NONE: Do nothing.
    • getQueryType

      public String getQueryType()
      Indicates how multiple attributes in a query should be concatenated together. Accepted values are: *
      • AND: Concatenate attributes in the query using an AND-clause.
      • OR: Concatenate attributes in the query using an OR-clause.
    • getColumnMappings

      public Map<String,String> getColumnMappings()
      Used only when there is a mapping of many rows to one user. This is done using a key-value structure where the key is the name of the "attribute name" column the value is the name of the "attribute value" column. If the table structure is as such: <pre> ----------------------------- uid | attr_name | attr_value ----------------------------- tom | first_name | Thomas </pre> Then a column mapping must be specified to teach CAS to use attr_name and attr_value for attribute names and values.
    • getUsername

      public List<String> getUsername()
      Username attribute(s) to use when running the SQL query.
    • getOrder

      public int getOrder()
      The order of this attribute repository in the chain of repositories. Can be used to explicitly position this source in chain and affects merging strategies.
    • getId

      public String getId()
      A value can be assigned to this field to uniquely identify this resolver.
    • getAttributes

      public Map<String,String> getAttributes()
      Map of attributes to fetch from the database. Attributes are defined using a key-value structure where CAS allows the attribute name/key to be renamed virtually to a different attribute. The key is the attribute fetched from the data source and the value is the attribute name CAS should use for virtual renames. Attributes may be allowed to be virtually renamed and remapped. The key in the attribute map is the original attribute, and the value should be the virtually-renamed attribute.
    • getCaseInsensitiveQueryAttributes

      public List<String> getCaseInsensitiveQueryAttributes()
      Collection of attributes, used to build the SQL query, that should go through a case canonicalization process defined as key->value. Note that the key is not the name of the attribute, but the query attribute that is used in generating the final query clause (i.e. username). The value can be NONE, LOWER, UPPER.

      It's also possible to define a list of attributes without a case canonicalization override such as username, attribute2 in which case caseCanonicalization will dictate the final outcome.

    • getQueryAttributes

      public Map<String,String> getQueryAttributes()
      Define a Map of query attribute names to data-layer attribute names to use when building the query. The key is always the name of the query attribute that is defined by CAS and passed internally, and the value is the database column that should map.
    • getState

      public AttributeRepositoryStates getState()
      Whether attribute resolution based on this source is enabled.
    • setSql

      The SQL statement to execute and fetch attributes. The syntax of the query must be SELECT * FROM table WHERE {0}. The WHERE clause is dynamically generated by CAS.
      Returns:
      this.
    • setSingleRow

      public JdbcPrincipalAttributesProperties setSingleRow(boolean singleRow)
      Designed to work against a table where there is a mapping of one row to one user. The fields in the table structure is assumed to match username|name|lastname|address where there is only a single row per user. Setting this setting to false will force CAS to work against a table where there is a mapping of one row to one user. The fields in the table structure is assumed to match username|attr_name|attr_value where there is more than one row per username.
      Returns:
      this.
    • setRequireAllAttributes

      public JdbcPrincipalAttributesProperties setRequireAllAttributes(boolean requireAllAttributes)
      If the SQL should only be run if all attributes listed in the mappings exist in the query.
      Returns:
      this.
    • setCaseCanonicalization

      public JdbcPrincipalAttributesProperties setCaseCanonicalization(String caseCanonicalization)
      When constructing the final person object from the attribute repository, indicate how the username should be canonicalized. Accepted values are:
      • UPPER: Transform the final person id into uppercase characters.
      • LOWER: Transform the final person id into lowercase characters.
      • NONE: Do nothing.
      Returns:
      this.
    • setQueryType

      public JdbcPrincipalAttributesProperties setQueryType(String queryType)
      Indicates how multiple attributes in a query should be concatenated together. Accepted values are: *
      • AND: Concatenate attributes in the query using an AND-clause.
      • OR: Concatenate attributes in the query using an OR-clause.
      Returns:
      this.
    • setColumnMappings

      public JdbcPrincipalAttributesProperties setColumnMappings(Map<String,String> columnMappings)
      Used only when there is a mapping of many rows to one user. This is done using a key-value structure where the key is the name of the "attribute name" column the value is the name of the "attribute value" column. If the table structure is as such: <pre> ----------------------------- uid | attr_name | attr_value ----------------------------- tom | first_name | Thomas </pre> Then a column mapping must be specified to teach CAS to use attr_name and attr_value for attribute names and values.
      Returns:
      this.
    • setUsername

      public JdbcPrincipalAttributesProperties setUsername(List<String> username)
      Username attribute(s) to use when running the SQL query.
      Returns:
      this.
    • setOrder

      public JdbcPrincipalAttributesProperties setOrder(int order)
      The order of this attribute repository in the chain of repositories. Can be used to explicitly position this source in chain and affects merging strategies.
      Returns:
      this.
    • setId

      A value can be assigned to this field to uniquely identify this resolver.
      Returns:
      this.
    • setAttributes

      public JdbcPrincipalAttributesProperties setAttributes(Map<String,String> attributes)
      Map of attributes to fetch from the database. Attributes are defined using a key-value structure where CAS allows the attribute name/key to be renamed virtually to a different attribute. The key is the attribute fetched from the data source and the value is the attribute name CAS should use for virtual renames. Attributes may be allowed to be virtually renamed and remapped. The key in the attribute map is the original attribute, and the value should be the virtually-renamed attribute.
      Returns:
      this.
    • setCaseInsensitiveQueryAttributes

      public JdbcPrincipalAttributesProperties setCaseInsensitiveQueryAttributes(List<String> caseInsensitiveQueryAttributes)
      Collection of attributes, used to build the SQL query, that should go through a case canonicalization process defined as key->value. Note that the key is not the name of the attribute, but the query attribute that is used in generating the final query clause (i.e. username). The value can be NONE, LOWER, UPPER.

      It's also possible to define a list of attributes without a case canonicalization override such as username, attribute2 in which case caseCanonicalization will dictate the final outcome.

      Returns:
      this.
    • setQueryAttributes

      public JdbcPrincipalAttributesProperties setQueryAttributes(Map<String,String> queryAttributes)
      Define a Map of query attribute names to data-layer attribute names to use when building the query. The key is always the name of the query attribute that is defined by CAS and passed internally, and the value is the database column that should map.
      Returns:
      this.
    • setState

      Whether attribute resolution based on this source is enabled.
      Returns:
      this.