ClientDetailsEntity.java

  1. /*******************************************************************************
  2.  * Copyright 2017 The MIT Internet Trust Consortium
  3.  *
  4.  * Portions copyright 2011-2013 The MITRE Corporation
  5.  *
  6.  * Licensed under the Apache License, Version 2.0 (the "License");
  7.  * you may not use this file except in compliance with the License.
  8.  * You may obtain a copy of the License at
  9.  *
  10.  *   http://www.apache.org/licenses/LICENSE-2.0
  11.  *
  12.  * Unless required by applicable law or agreed to in writing, software
  13.  * distributed under the License is distributed on an "AS IS" BASIS,
  14.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15.  * See the License for the specific language governing permissions and
  16.  * limitations under the License.
  17.  *******************************************************************************/
  18. /**
  19.  *
  20.  */
  21. package org.mitre.oauth2.model;

  22. import java.util.Date;
  23. import java.util.HashMap;
  24. import java.util.HashSet;
  25. import java.util.Map;
  26. import java.util.Set;

  27. import javax.persistence.Basic;
  28. import javax.persistence.CollectionTable;
  29. import javax.persistence.Column;
  30. import javax.persistence.Convert;
  31. import javax.persistence.ElementCollection;
  32. import javax.persistence.Entity;
  33. import javax.persistence.EnumType;
  34. import javax.persistence.Enumerated;
  35. import javax.persistence.FetchType;
  36. import javax.persistence.GeneratedValue;
  37. import javax.persistence.GenerationType;
  38. import javax.persistence.Id;
  39. import javax.persistence.JoinColumn;
  40. import javax.persistence.NamedQueries;
  41. import javax.persistence.NamedQuery;
  42. import javax.persistence.PrePersist;
  43. import javax.persistence.PreUpdate;
  44. import javax.persistence.Table;
  45. import javax.persistence.Temporal;
  46. import javax.persistence.TemporalType;
  47. import javax.persistence.Transient;

  48. import org.mitre.oauth2.model.convert.JWEAlgorithmStringConverter;
  49. import org.mitre.oauth2.model.convert.JWEEncryptionMethodStringConverter;
  50. import org.mitre.oauth2.model.convert.JWKSetStringConverter;
  51. import org.mitre.oauth2.model.convert.JWSAlgorithmStringConverter;
  52. import org.mitre.oauth2.model.convert.JWTStringConverter;
  53. import org.mitre.oauth2.model.convert.PKCEAlgorithmStringConverter;
  54. import org.mitre.oauth2.model.convert.SimpleGrantedAuthorityStringConverter;
  55. import org.springframework.security.core.GrantedAuthority;
  56. import org.springframework.security.oauth2.provider.ClientDetails;

  57. import com.nimbusds.jose.EncryptionMethod;
  58. import com.nimbusds.jose.JWEAlgorithm;
  59. import com.nimbusds.jose.JWSAlgorithm;
  60. import com.nimbusds.jose.jwk.JWKSet;
  61. import com.nimbusds.jwt.JWT;

  62. /**
  63.  * @author jricher
  64.  *
  65.  */
  66. @Entity
  67. @Table(name = "client_details")
  68. @NamedQueries({
  69.     @NamedQuery(name = ClientDetailsEntity.QUERY_ALL, query = "SELECT c FROM ClientDetailsEntity c"),
  70.     @NamedQuery(name = ClientDetailsEntity.QUERY_BY_CLIENT_ID, query = "select c from ClientDetailsEntity c where c.clientId = :" + ClientDetailsEntity.PARAM_CLIENT_ID)
  71. })
  72. public class ClientDetailsEntity implements ClientDetails {

  73.     public static final String QUERY_BY_CLIENT_ID = "ClientDetailsEntity.getByClientId";
  74.     public static final String QUERY_ALL = "ClientDetailsEntity.findAll";

  75.     public static final String PARAM_CLIENT_ID = "clientId";

  76.     private static final int DEFAULT_ID_TOKEN_VALIDITY_SECONDS = 600;

  77.     private static final long serialVersionUID = -1617727085733786296L;

  78.     private Long id;

  79.     /** Fields from the OAuth2 Dynamic Registration Specification */
  80.     private String clientId = null; // client_id
  81.     private String clientSecret = null; // client_secret
  82.     private Set<String> redirectUris = new HashSet<>(); // redirect_uris
  83.     private String clientName; // client_name
  84.     private String clientUri; // client_uri
  85.     private String logoUri; // logo_uri
  86.     private Set<String> contacts; // contacts
  87.     private String tosUri; // tos_uri
  88.     private AuthMethod tokenEndpointAuthMethod = AuthMethod.SECRET_BASIC; // token_endpoint_auth_method
  89.     private Set<String> scope = new HashSet<>(); // scope
  90.     private Set<String> grantTypes = new HashSet<>(); // grant_types
  91.     private Set<String> responseTypes = new HashSet<>(); // response_types
  92.     private String policyUri;
  93.     private String jwksUri; // URI pointer to keys
  94.     private JWKSet jwks; // public key stored by value
  95.     private String softwareId;
  96.     private String softwareVersion;

  97.     /** Fields from OIDC Client Registration Specification **/
  98.     private AppType applicationType; // application_type
  99.     private String sectorIdentifierUri; // sector_identifier_uri
  100.     private SubjectType subjectType; // subject_type

  101.     private JWSAlgorithm requestObjectSigningAlg = null; // request_object_signing_alg

  102.     private JWSAlgorithm userInfoSignedResponseAlg = null; // user_info_signed_response_alg
  103.     private JWEAlgorithm userInfoEncryptedResponseAlg = null; // user_info_encrypted_response_alg
  104.     private EncryptionMethod userInfoEncryptedResponseEnc = null; // user_info_encrypted_response_enc

  105.     private JWSAlgorithm idTokenSignedResponseAlg = null; // id_token_signed_response_alg
  106.     private JWEAlgorithm idTokenEncryptedResponseAlg = null; // id_token_encrypted_response_alg
  107.     private EncryptionMethod idTokenEncryptedResponseEnc = null; // id_token_encrypted_response_enc

  108.     private JWSAlgorithm tokenEndpointAuthSigningAlg = null; // token_endpoint_auth_signing_alg

  109.     private Integer defaultMaxAge; // default_max_age
  110.     private Boolean requireAuthTime; // require_auth_time
  111.     private Set<String> defaultACRvalues; // default_acr_values

  112.     private String initiateLoginUri; // initiate_login_uri
  113.     private Set<String> postLogoutRedirectUris; // post_logout_redirect_uris

  114.     private Set<String> requestUris; // request_uris

  115.     /** Fields to support the ClientDetails interface **/
  116.     private Set<GrantedAuthority> authorities = new HashSet<>();
  117.     private Integer accessTokenValiditySeconds = 0; // in seconds
  118.     private Integer refreshTokenValiditySeconds = 0; // in seconds
  119.     private Set<String> resourceIds = new HashSet<>();
  120.     private Map<String, Object> additionalInformation = new HashMap<>();

  121.     /** Our own fields **/
  122.     private String clientDescription = ""; // human-readable description
  123.     private boolean reuseRefreshToken = true; // do we let someone reuse a refresh token?
  124.     private boolean dynamicallyRegistered = false; // was this client dynamically registered?
  125.     private boolean allowIntrospection = false; // do we let this client call the introspection endpoint?
  126.     private Integer idTokenValiditySeconds; //timeout for id tokens
  127.     private Date createdAt; // time the client was created
  128.     private boolean clearAccessTokensOnRefresh = true; // do we clear access tokens on refresh?
  129.     private Integer deviceCodeValiditySeconds; // timeout for device codes

  130.     /** fields for UMA */
  131.     private Set<String> claimsRedirectUris;

  132.     /** Software statement **/
  133.     private JWT softwareStatement;

  134.     /** PKCE **/
  135.     private PKCEAlgorithm codeChallengeMethod;

  136.     public enum AuthMethod {
  137.         SECRET_POST("client_secret_post"),
  138.         SECRET_BASIC("client_secret_basic"),
  139.         SECRET_JWT("client_secret_jwt"),
  140.         PRIVATE_KEY("private_key_jwt"),
  141.         NONE("none");

  142.         private final String value;

  143.         // map to aid reverse lookup
  144.         private static final Map<String, AuthMethod> lookup = new HashMap<>();
  145.         static {
  146.             for (AuthMethod a : AuthMethod.values()) {
  147.                 lookup.put(a.getValue(), a);
  148.             }
  149.         }

  150.         AuthMethod(String value) {
  151.             this.value = value;
  152.         }

  153.         public String getValue() {
  154.             return value;
  155.         }

  156.         public static AuthMethod getByValue(String value) {
  157.             return lookup.get(value);
  158.         }
  159.     }

  160.     public enum AppType {
  161.         WEB("web"), NATIVE("native");

  162.         private final String value;

  163.         // map to aid reverse lookup
  164.         private static final Map<String, AppType> lookup = new HashMap<>();
  165.         static {
  166.             for (AppType a : AppType.values()) {
  167.                 lookup.put(a.getValue(), a);
  168.             }
  169.         }

  170.         AppType(String value) {
  171.             this.value = value;
  172.         }

  173.         public String getValue() {
  174.             return value;
  175.         }

  176.         public static AppType getByValue(String value) {
  177.             return lookup.get(value);
  178.         }
  179.     }

  180.     public enum SubjectType {
  181.         PAIRWISE("pairwise"), PUBLIC("public");

  182.         private final String value;

  183.         // map to aid reverse lookup
  184.         private static final Map<String, SubjectType> lookup = new HashMap<>();
  185.         static {
  186.             for (SubjectType u : SubjectType.values()) {
  187.                 lookup.put(u.getValue(), u);
  188.             }
  189.         }

  190.         SubjectType(String value) {
  191.             this.value = value;
  192.         }

  193.         public String getValue() {
  194.             return value;
  195.         }

  196.         public static SubjectType getByValue(String value) {
  197.             return lookup.get(value);
  198.         }
  199.     }

  200.     /**
  201.      * Create a blank ClientDetailsEntity
  202.      */
  203.     public ClientDetailsEntity() {

  204.     }

  205.     @PrePersist
  206.     @PreUpdate
  207.     private void prePersist() {
  208.         // make sure that ID tokens always time out, default to 5 minutes
  209.         if (getIdTokenValiditySeconds() == null) {
  210.             setIdTokenValiditySeconds(DEFAULT_ID_TOKEN_VALIDITY_SECONDS);
  211.         }
  212.     }

  213.     /**
  214.      * @return the id
  215.      */
  216.     @Id
  217.     @GeneratedValue(strategy = GenerationType.IDENTITY)
  218.     @Column(name = "id")
  219.     public Long getId() {
  220.         return id;
  221.     }

  222.     /**
  223.      *
  224.      * @param id the id to set
  225.      */
  226.     public void setId(Long id) {
  227.         this.id = id;
  228.     }

  229.     /**
  230.      * @return the clientDescription
  231.      */
  232.     @Basic
  233.     @Column(name="client_description")
  234.     public String getClientDescription() {
  235.         return clientDescription;
  236.     }

  237.     /**
  238.      * @param clientDescription Human-readable long description of the client (optional)
  239.      */
  240.     public void setClientDescription(String clientDescription) {
  241.         this.clientDescription = clientDescription;
  242.     }

  243.     /**
  244.      * @return the allowRefresh
  245.      */
  246.     @Transient
  247.     public boolean isAllowRefresh() {
  248.         if (grantTypes != null) {
  249.             return getAuthorizedGrantTypes().contains("refresh_token");
  250.         } else {
  251.             return false; // if there are no grants, we can't be refreshing them, can we?
  252.         }
  253.     }

  254.     @Basic
  255.     @Column(name="reuse_refresh_tokens")
  256.     public boolean isReuseRefreshToken() {
  257.         return reuseRefreshToken;
  258.     }

  259.     public void setReuseRefreshToken(boolean reuseRefreshToken) {
  260.         this.reuseRefreshToken = reuseRefreshToken;
  261.     }

  262.     /**
  263.      * Number of seconds ID token is valid for. MUST be a positive integer, can not be null.
  264.      *
  265.      * @return the idTokenValiditySeconds
  266.      */
  267.     @Basic
  268.     @Column(name="id_token_validity_seconds")
  269.     public Integer getIdTokenValiditySeconds() {
  270.         return idTokenValiditySeconds;
  271.     }

  272.     /**
  273.      * @param idTokenValiditySeconds the idTokenValiditySeconds to set
  274.      */
  275.     public void setIdTokenValiditySeconds(Integer idTokenValiditySeconds) {
  276.         this.idTokenValiditySeconds = idTokenValiditySeconds;
  277.     }

  278.     /**
  279.      * @return the dynamicallyRegistered
  280.      */
  281.     @Basic
  282.     @Column(name="dynamically_registered")
  283.     public boolean isDynamicallyRegistered() {
  284.         return dynamicallyRegistered;
  285.     }

  286.     /**
  287.      * @param dynamicallyRegistered the dynamicallyRegistered to set
  288.      */
  289.     public void setDynamicallyRegistered(boolean dynamicallyRegistered) {
  290.         this.dynamicallyRegistered = dynamicallyRegistered;
  291.     }





  292.     /**
  293.      * @return the allowIntrospection
  294.      */
  295.     @Basic
  296.     @Column(name="allow_introspection")
  297.     public boolean isAllowIntrospection() {
  298.         return allowIntrospection;
  299.     }

  300.     /**
  301.      * @param allowIntrospection the allowIntrospection to set
  302.      */
  303.     public void setAllowIntrospection(boolean allowIntrospection) {
  304.         this.allowIntrospection = allowIntrospection;
  305.     }

  306.     /**
  307.      *
  308.      */
  309.     @Override
  310.     @Transient
  311.     public boolean isSecretRequired() {
  312.         if (getTokenEndpointAuthMethod() != null &&
  313.                 (getTokenEndpointAuthMethod().equals(AuthMethod.SECRET_BASIC) ||
  314.                         getTokenEndpointAuthMethod().equals(AuthMethod.SECRET_POST) ||
  315.                         getTokenEndpointAuthMethod().equals(AuthMethod.SECRET_JWT))) {
  316.             return true;
  317.         } else {
  318.             return false;
  319.         }

  320.     }

  321.     /**
  322.      * If the scope list is not null or empty, then this client has been scoped.
  323.      */
  324.     @Override
  325.     @Transient
  326.     public boolean isScoped() {
  327.         return getScope() != null && !getScope().isEmpty();
  328.     }

  329.     /**
  330.      * @return the clientId
  331.      */
  332.     @Basic
  333.     @Override
  334.     @Column(name="client_id")
  335.     public String getClientId() {
  336.         return clientId;
  337.     }

  338.     /**
  339.      * @param clientId The OAuth2 client_id, must be unique to this client
  340.      */
  341.     public void setClientId(String clientId) {
  342.         this.clientId = clientId;
  343.     }

  344.     /**
  345.      * @return the clientSecret
  346.      */
  347.     @Basic
  348.     @Override
  349.     @Column(name="client_secret")
  350.     public String getClientSecret() {
  351.         return clientSecret;
  352.     }

  353.     /**
  354.      * @param clientSecret the OAuth2 client_secret (optional)
  355.      */
  356.     public void setClientSecret(String clientSecret) {
  357.         this.clientSecret = clientSecret;
  358.     }

  359.     /**
  360.      * @return the scope
  361.      */
  362.     @ElementCollection(fetch = FetchType.EAGER)
  363.     @CollectionTable(
  364.             name="client_scope",
  365.             joinColumns=@JoinColumn(name="owner_id")
  366.             )
  367.     @Override
  368.     @Column(name="scope")
  369.     public Set<String> getScope() {
  370.         return scope;
  371.     }

  372.     /**
  373.      * @param scope the set of scopes allowed to be issued to this client
  374.      */
  375.     public void setScope(Set<String> scope) {
  376.         this.scope = scope;
  377.     }

  378.     /**
  379.      * @return the authorizedGrantTypes
  380.      */
  381.     @ElementCollection(fetch = FetchType.EAGER)
  382.     @CollectionTable(
  383.             name="client_grant_type",
  384.             joinColumns=@JoinColumn(name="owner_id")
  385.             )
  386.     @Column(name="grant_type")
  387.     public Set<String> getGrantTypes() {
  388.         return grantTypes;
  389.     }

  390.     /**
  391.      * @param authorizedGrantTypes the OAuth2 grant types that this client is allowed to use
  392.      */
  393.     public void setGrantTypes(Set<String> grantTypes) {
  394.         this.grantTypes = grantTypes;
  395.     }

  396.     /**
  397.      * passthrough for SECOAUTH api
  398.      */
  399.     @Override
  400.     @Transient
  401.     public Set<String> getAuthorizedGrantTypes() {
  402.         return getGrantTypes();
  403.     }

  404.     /**
  405.      * @return the authorities
  406.      */
  407.     @ElementCollection(fetch = FetchType.EAGER)
  408.     @CollectionTable(
  409.             name="client_authority",
  410.             joinColumns=@JoinColumn(name="owner_id")
  411.             )
  412.     @Override
  413.     @Convert(converter = SimpleGrantedAuthorityStringConverter.class)
  414.     @Column(name="authority")
  415.     public Set<GrantedAuthority> getAuthorities() {
  416.         return authorities;
  417.     }

  418.     /**
  419.      * @param authorities the Spring Security authorities this client is given
  420.      */
  421.     public void setAuthorities(Set<GrantedAuthority> authorities) {
  422.         this.authorities = authorities;
  423.     }

  424.     @Override
  425.     @Basic
  426.     @Column(name="access_token_validity_seconds")
  427.     public Integer getAccessTokenValiditySeconds() {
  428.         return accessTokenValiditySeconds;
  429.     }

  430.     /**
  431.      * @param accessTokenTimeout the accessTokenTimeout to set
  432.      */
  433.     public void setAccessTokenValiditySeconds(Integer accessTokenValiditySeconds) {
  434.         this.accessTokenValiditySeconds = accessTokenValiditySeconds;
  435.     }

  436.     @Override
  437.     @Basic
  438.     @Column(name="refresh_token_validity_seconds")
  439.     public Integer getRefreshTokenValiditySeconds() {
  440.         return refreshTokenValiditySeconds;
  441.     }

  442.     /**
  443.      * @param refreshTokenTimeout Lifetime of refresh tokens, in seconds (optional - leave null for no timeout)
  444.      */
  445.     public void setRefreshTokenValiditySeconds(Integer refreshTokenValiditySeconds) {
  446.         this.refreshTokenValiditySeconds = refreshTokenValiditySeconds;
  447.     }

  448.     /**
  449.      * @return the registeredRedirectUri
  450.      */
  451.     @ElementCollection(fetch = FetchType.EAGER)
  452.     @CollectionTable(
  453.             name="client_redirect_uri",
  454.             joinColumns=@JoinColumn(name="owner_id")
  455.             )
  456.     @Column(name="redirect_uri")
  457.     public Set<String> getRedirectUris() {
  458.         return redirectUris;
  459.     }

  460.     /**
  461.      * @param registeredRedirectUri the registeredRedirectUri to set
  462.      */
  463.     public void setRedirectUris(Set<String> redirectUris) {
  464.         this.redirectUris = redirectUris;
  465.     }

  466.     /**
  467.      * Pass-through method to fulfill the ClientDetails interface with a bad name
  468.      */
  469.     @Override
  470.     @Transient
  471.     public Set<String> getRegisteredRedirectUri() {
  472.         return getRedirectUris();
  473.     }

  474.     /**
  475.      * @return the resourceIds
  476.      */
  477.     @Override
  478.     @ElementCollection(fetch = FetchType.EAGER)
  479.     @CollectionTable(
  480.             name="client_resource",
  481.             joinColumns=@JoinColumn(name="owner_id")
  482.             )
  483.     @Column(name="resource_id")
  484.     public Set<String> getResourceIds() {
  485.         return resourceIds;
  486.     }

  487.     /**
  488.      * @param resourceIds the resourceIds to set
  489.      */
  490.     public void setResourceIds(Set<String> resourceIds) {
  491.         this.resourceIds = resourceIds;
  492.     }


  493.     /**
  494.      * This library does not make use of this field, so it is not
  495.      * stored using our persistence layer.
  496.      *
  497.      * However, it's somehow required by SECOUATH.
  498.      *
  499.      * @return an empty map
  500.      */
  501.     @Override
  502.     @Transient
  503.     public Map<String, Object> getAdditionalInformation() {
  504.         return this.additionalInformation;
  505.     }




  506.     @Enumerated(EnumType.STRING)
  507.     @Column(name="application_type")
  508.     public AppType getApplicationType() {
  509.         return applicationType;
  510.     }

  511.     public void setApplicationType(AppType applicationType) {
  512.         this.applicationType = applicationType;
  513.     }

  514.     @Basic
  515.     @Column(name="client_name")
  516.     public String getClientName() {
  517.         return clientName;
  518.     }

  519.     public void setClientName(String clientName) {
  520.         this.clientName = clientName;
  521.     }

  522.     @Enumerated(EnumType.STRING)
  523.     @Column(name="token_endpoint_auth_method")
  524.     public AuthMethod getTokenEndpointAuthMethod() {
  525.         return tokenEndpointAuthMethod;
  526.     }

  527.     public void setTokenEndpointAuthMethod(AuthMethod tokenEndpointAuthMethod) {
  528.         this.tokenEndpointAuthMethod = tokenEndpointAuthMethod;
  529.     }

  530.     @Enumerated(EnumType.STRING)
  531.     @Column(name="subject_type")
  532.     public SubjectType getSubjectType() {
  533.         return subjectType;
  534.     }

  535.     public void setSubjectType(SubjectType subjectType) {
  536.         this.subjectType = subjectType;
  537.     }

  538.     @ElementCollection(fetch = FetchType.EAGER)
  539.     @CollectionTable(
  540.             name="client_contact",
  541.             joinColumns=@JoinColumn(name="owner_id")
  542.             )
  543.     @Column(name="contact")
  544.     public Set<String> getContacts() {
  545.         return contacts;
  546.     }

  547.     public void setContacts(Set<String> contacts) {
  548.         this.contacts = contacts;
  549.     }

  550.     @Basic
  551.     @Column(name="logo_uri")
  552.     public String getLogoUri() {
  553.         return logoUri;
  554.     }

  555.     public void setLogoUri(String logoUri) {
  556.         this.logoUri = logoUri;
  557.     }

  558.     @Basic
  559.     @Column(name="policy_uri")
  560.     public String getPolicyUri() {
  561.         return policyUri;
  562.     }

  563.     public void setPolicyUri(String policyUri) {
  564.         this.policyUri = policyUri;
  565.     }

  566.     /**
  567.      * @return the clientUrl
  568.      */
  569.     @Basic
  570.     @Column(name="client_uri")
  571.     public String getClientUri() {
  572.         return clientUri;
  573.     }

  574.     /**
  575.      * @param clientUrl the clientUrl to set
  576.      */
  577.     public void setClientUri(String clientUri) {
  578.         this.clientUri = clientUri;
  579.     }

  580.     /**
  581.      * @return the tosUrl
  582.      */
  583.     @Basic
  584.     @Column(name="tos_uri")
  585.     public String getTosUri() {
  586.         return tosUri;
  587.     }

  588.     /**
  589.      * @param tosUrl the tosUrl to set
  590.      */
  591.     public void setTosUri(String tosUri) {
  592.         this.tosUri = tosUri;
  593.     }

  594.     @Basic
  595.     @Column(name="jwks_uri")
  596.     public String getJwksUri() {
  597.         return jwksUri;
  598.     }

  599.     public void setJwksUri(String jwksUri) {
  600.         this.jwksUri = jwksUri;
  601.     }

  602.     /**
  603.      * @return the jwks
  604.      */
  605.     @Basic
  606.     @Column(name="jwks")
  607.     @Convert(converter = JWKSetStringConverter.class)
  608.     public JWKSet getJwks() {
  609.         return jwks;
  610.     }

  611.     /**
  612.      * @param jwks the jwks to set
  613.      */
  614.     public void setJwks(JWKSet jwks) {
  615.         this.jwks = jwks;
  616.     }

  617.     @Basic
  618.     @Column(name="sector_identifier_uri")
  619.     public String getSectorIdentifierUri() {
  620.         return sectorIdentifierUri;
  621.     }

  622.     public void setSectorIdentifierUri(String sectorIdentifierUri) {
  623.         this.sectorIdentifierUri = sectorIdentifierUri;
  624.     }

  625.     @Basic
  626.     @Column(name = "request_object_signing_alg")
  627.     @Convert(converter = JWSAlgorithmStringConverter.class)
  628.     public JWSAlgorithm getRequestObjectSigningAlg() {
  629.         return requestObjectSigningAlg;
  630.     }

  631.     public void setRequestObjectSigningAlg(JWSAlgorithm requestObjectSigningAlg) {
  632.         this.requestObjectSigningAlg = requestObjectSigningAlg;
  633.     }

  634.     @Basic
  635.     @Column(name = "user_info_signed_response_alg")
  636.     @Convert(converter = JWSAlgorithmStringConverter.class)
  637.     public JWSAlgorithm getUserInfoSignedResponseAlg() {
  638.         return userInfoSignedResponseAlg;
  639.     }

  640.     public void setUserInfoSignedResponseAlg(JWSAlgorithm userInfoSignedResponseAlg) {
  641.         this.userInfoSignedResponseAlg = userInfoSignedResponseAlg;
  642.     }

  643.     @Basic
  644.     @Column(name = "user_info_encrypted_response_alg")
  645.     @Convert(converter = JWEAlgorithmStringConverter.class)
  646.     public JWEAlgorithm getUserInfoEncryptedResponseAlg() {
  647.         return userInfoEncryptedResponseAlg;
  648.     }

  649.     public void setUserInfoEncryptedResponseAlg(JWEAlgorithm userInfoEncryptedResponseAlg) {
  650.         this.userInfoEncryptedResponseAlg = userInfoEncryptedResponseAlg;
  651.     }

  652.     @Basic
  653.     @Column(name = "user_info_encrypted_response_enc")
  654.     @Convert(converter = JWEEncryptionMethodStringConverter.class)
  655.     public EncryptionMethod getUserInfoEncryptedResponseEnc() {
  656.         return userInfoEncryptedResponseEnc;
  657.     }

  658.     public void setUserInfoEncryptedResponseEnc(EncryptionMethod userInfoEncryptedResponseEnc) {
  659.         this.userInfoEncryptedResponseEnc = userInfoEncryptedResponseEnc;
  660.     }

  661.     @Basic
  662.     @Column(name="id_token_signed_response_alg")
  663.     @Convert(converter = JWSAlgorithmStringConverter.class)
  664.     public JWSAlgorithm getIdTokenSignedResponseAlg() {
  665.         return idTokenSignedResponseAlg;
  666.     }

  667.     public void setIdTokenSignedResponseAlg(JWSAlgorithm idTokenSignedResponseAlg) {
  668.         this.idTokenSignedResponseAlg = idTokenSignedResponseAlg;
  669.     }

  670.     @Basic
  671.     @Column(name = "id_token_encrypted_response_alg")
  672.     @Convert(converter = JWEAlgorithmStringConverter.class)
  673.     public JWEAlgorithm getIdTokenEncryptedResponseAlg() {
  674.         return idTokenEncryptedResponseAlg;
  675.     }

  676.     public void setIdTokenEncryptedResponseAlg(JWEAlgorithm idTokenEncryptedResponseAlg) {
  677.         this.idTokenEncryptedResponseAlg = idTokenEncryptedResponseAlg;
  678.     }

  679.     @Basic
  680.     @Column(name = "id_token_encrypted_response_enc")
  681.     @Convert(converter = JWEEncryptionMethodStringConverter.class)
  682.     public EncryptionMethod getIdTokenEncryptedResponseEnc() {
  683.         return idTokenEncryptedResponseEnc;
  684.     }

  685.     public void setIdTokenEncryptedResponseEnc(EncryptionMethod idTokenEncryptedResponseEnc) {
  686.         this.idTokenEncryptedResponseEnc = idTokenEncryptedResponseEnc;
  687.     }

  688.     @Basic
  689.     @Column(name="token_endpoint_auth_signing_alg")
  690.     @Convert(converter = JWSAlgorithmStringConverter.class)
  691.     public JWSAlgorithm getTokenEndpointAuthSigningAlg() {
  692.         return tokenEndpointAuthSigningAlg;
  693.     }

  694.     public void setTokenEndpointAuthSigningAlg(JWSAlgorithm tokenEndpointAuthSigningAlg) {
  695.         this.tokenEndpointAuthSigningAlg = tokenEndpointAuthSigningAlg;
  696.     }

  697.     @Basic
  698.     @Column(name="default_max_age")
  699.     public Integer getDefaultMaxAge() {
  700.         return defaultMaxAge;
  701.     }

  702.     public void setDefaultMaxAge(Integer defaultMaxAge) {
  703.         this.defaultMaxAge = defaultMaxAge;
  704.     }

  705.     @Basic
  706.     @Column(name="require_auth_time")
  707.     public Boolean getRequireAuthTime() {
  708.         return requireAuthTime;
  709.     }

  710.     public void setRequireAuthTime(Boolean requireAuthTime) {
  711.         this.requireAuthTime = requireAuthTime;
  712.     }

  713.     /**
  714.      * @return the responseTypes
  715.      */
  716.     @ElementCollection(fetch = FetchType.EAGER)
  717.     @CollectionTable(
  718.             name="client_response_type",
  719.             joinColumns=@JoinColumn(name="owner_id")
  720.             )
  721.     @Column(name="response_type")
  722.     public Set<String> getResponseTypes() {
  723.         return responseTypes;
  724.     }

  725.     /**
  726.      * @param responseTypes the responseTypes to set
  727.      */
  728.     public void setResponseTypes(Set<String> responseTypes) {
  729.         this.responseTypes = responseTypes;
  730.     }

  731.     /**
  732.      * @return the defaultACRvalues
  733.      */
  734.     @ElementCollection(fetch = FetchType.EAGER)
  735.     @CollectionTable(
  736.             name="client_default_acr_value",
  737.             joinColumns=@JoinColumn(name="owner_id")
  738.             )
  739.     @Column(name="default_acr_value")
  740.     public Set<String> getDefaultACRvalues() {
  741.         return defaultACRvalues;
  742.     }

  743.     /**
  744.      * @param defaultACRvalues the defaultACRvalues to set
  745.      */
  746.     public void setDefaultACRvalues(Set<String> defaultACRvalues) {
  747.         this.defaultACRvalues = defaultACRvalues;
  748.     }

  749.     /**
  750.      * @return the initiateLoginUri
  751.      */
  752.     @Basic
  753.     @Column(name="initiate_login_uri")
  754.     public String getInitiateLoginUri() {
  755.         return initiateLoginUri;
  756.     }

  757.     /**
  758.      * @param initiateLoginUri the initiateLoginUri to set
  759.      */
  760.     public void setInitiateLoginUri(String initiateLoginUri) {
  761.         this.initiateLoginUri = initiateLoginUri;
  762.     }

  763.     /**
  764.      * @return the postLogoutRedirectUri
  765.      */
  766.     @ElementCollection(fetch = FetchType.EAGER)
  767.     @CollectionTable(
  768.             name="client_post_logout_redirect_uri",
  769.             joinColumns=@JoinColumn(name="owner_id")
  770.             )
  771.     @Column(name="post_logout_redirect_uri")
  772.     public Set<String> getPostLogoutRedirectUris() {
  773.         return postLogoutRedirectUris;
  774.     }

  775.     /**
  776.      * @param postLogoutRedirectUri the postLogoutRedirectUri to set
  777.      */
  778.     public void setPostLogoutRedirectUris(Set<String> postLogoutRedirectUri) {
  779.         this.postLogoutRedirectUris = postLogoutRedirectUri;
  780.     }

  781.     /**
  782.      * @return the requestUris
  783.      */
  784.     @ElementCollection(fetch = FetchType.EAGER)
  785.     @CollectionTable(
  786.             name="client_request_uri",
  787.             joinColumns=@JoinColumn(name="owner_id")
  788.             )
  789.     @Column(name="request_uri")
  790.     public Set<String> getRequestUris() {
  791.         return requestUris;
  792.     }

  793.     /**
  794.      * @param requestUris the requestUris to set
  795.      */
  796.     public void setRequestUris(Set<String> requestUris) {
  797.         this.requestUris = requestUris;
  798.     }

  799.     /**
  800.      * @return the createdAt
  801.      */
  802.     @Temporal(TemporalType.TIMESTAMP)
  803.     @Column(name="created_at")
  804.     public Date getCreatedAt() {
  805.         return createdAt;
  806.     }

  807.     /**
  808.      * @param createdAt the createdAt to set
  809.      */
  810.     public void setCreatedAt(Date createdAt) {
  811.         this.createdAt = createdAt;
  812.     }

  813.     /**
  814.      * Our framework doesn't use this construct, we use WhitelistedSites and ApprovedSites instead.
  815.      */
  816.     @Override
  817.     public boolean isAutoApprove(String scope) {
  818.         return false;
  819.     }

  820.     /**
  821.      * @return the clearAccessTokensOnRefresh
  822.      */
  823.     @Basic
  824.     @Column(name = "clear_access_tokens_on_refresh")
  825.     public boolean isClearAccessTokensOnRefresh() {
  826.         return clearAccessTokensOnRefresh;
  827.     }

  828.     /**
  829.      * @param clearAccessTokensOnRefresh the clearAccessTokensOnRefresh to set
  830.      */
  831.     public void setClearAccessTokensOnRefresh(boolean clearAccessTokensOnRefresh) {
  832.         this.clearAccessTokensOnRefresh = clearAccessTokensOnRefresh;
  833.     }

  834.     /**
  835.      * @return the claimsRedirectUris
  836.      */
  837.     @ElementCollection(fetch = FetchType.EAGER)
  838.     @CollectionTable(
  839.             name="client_claims_redirect_uri",
  840.             joinColumns=@JoinColumn(name="owner_id")
  841.             )
  842.     @Column(name="redirect_uri")
  843.     public Set<String> getClaimsRedirectUris() {
  844.         return claimsRedirectUris;
  845.     }

  846.     /**
  847.      * @param claimsRedirectUris the claimsRedirectUris to set
  848.      */
  849.     public void setClaimsRedirectUris(Set<String> claimsRedirectUris) {
  850.         this.claimsRedirectUris = claimsRedirectUris;
  851.     }

  852.     /**
  853.      * @return the softwareStatement
  854.      */
  855.     @Basic
  856.     @Column(name = "software_statement")
  857.     @Convert(converter = JWTStringConverter.class)
  858.     public JWT getSoftwareStatement() {
  859.         return softwareStatement;
  860.     }

  861.     /**
  862.      * @param softwareStatement the softwareStatement to set
  863.      */
  864.     public void setSoftwareStatement(JWT softwareStatement) {
  865.         this.softwareStatement = softwareStatement;
  866.     }

  867.     /**
  868.      * @return the codeChallengeMethod
  869.      */
  870.     @Basic
  871.     @Column(name = "code_challenge_method")
  872.     @Convert(converter = PKCEAlgorithmStringConverter.class)
  873.     public PKCEAlgorithm getCodeChallengeMethod() {
  874.         return codeChallengeMethod;
  875.     }

  876.     /**
  877.      * @param codeChallengeMethod the codeChallengeMethod to set
  878.      */
  879.     public void setCodeChallengeMethod(PKCEAlgorithm codeChallengeMethod) {
  880.         this.codeChallengeMethod = codeChallengeMethod;
  881.     }

  882.     /**
  883.      * @return the deviceCodeValiditySeconds
  884.      */
  885.     @Basic
  886.     @Column(name="device_code_validity_seconds")
  887.     public Integer getDeviceCodeValiditySeconds() {
  888.         return deviceCodeValiditySeconds;
  889.     }

  890.     /**
  891.      * @param deviceCodeValiditySeconds the deviceCodeValiditySeconds to set
  892.      */
  893.     public void setDeviceCodeValiditySeconds(Integer deviceCodeValiditySeconds) {
  894.         this.deviceCodeValiditySeconds = deviceCodeValiditySeconds;
  895.     }

  896.     /**
  897.      * @return the softwareId
  898.      */
  899.     @Basic
  900.     @Column(name="software_id")
  901.     public String getSoftwareId() {
  902.         return softwareId;
  903.     }

  904.     /**
  905.      * @param softwareId the softwareId to set
  906.      */
  907.     public void setSoftwareId(String softwareId) {
  908.         this.softwareId = softwareId;
  909.     }

  910.     /**
  911.      * @return the softwareVersion
  912.      */
  913.     @Basic
  914.     @Column(name="software_version")
  915.     public String getSoftwareVersion() {
  916.         return softwareVersion;
  917.     }

  918.     /**
  919.      * @param softwareVersion the softwareVersion to set
  920.      */
  921.     public void setSoftwareVersion(String softwareVersion) {
  922.         this.softwareVersion = softwareVersion;
  923.     }

  924. }