From 0ab4ad4bbe71df7314ff0740aa12d28a15592cc4 Mon Sep 17 00:00:00 2001 From: Justin Richer Date: Fri, 18 Jan 2013 15:38:41 -0500 Subject: [PATCH] added "birthdate", addresses #253 --- .../openid/connect/model/DefaultUserInfo.java | 18 ++++++++++++++++++ .../mitre/openid/connect/model/UserInfo.java | 14 ++++++++++++++ .../openid/connect/view/JSONUserInfoView.java | 1 + .../db/tables/hsql_database_tables.sql | 3 ++- .../db/tables/loading_temp_tables.sql | 3 ++- .../db/tables/mysql_database_tables.sql | 3 ++- 6 files changed, 39 insertions(+), 3 deletions(-) diff --git a/openid-connect-common/src/main/java/org/mitre/openid/connect/model/DefaultUserInfo.java b/openid-connect-common/src/main/java/org/mitre/openid/connect/model/DefaultUserInfo.java index 66a5ff99d..68a96c444 100644 --- a/openid-connect-common/src/main/java/org/mitre/openid/connect/model/DefaultUserInfo.java +++ b/openid-connect-common/src/main/java/org/mitre/openid/connect/model/DefaultUserInfo.java @@ -55,6 +55,7 @@ public class DefaultUserInfo implements UserInfo { private String phoneNumber; private Address address; private String updatedTime; + private String birthdate; /* (non-Javadoc) @@ -340,6 +341,21 @@ public class DefaultUserInfo implements UserInfo { } /** + * @return the birthdate + */ + @Basic + @Column(name="birthdate") + public String getBirthdate() { + return birthdate; + } + /** + * @param birthdate the birthdate to set + */ + public void setBirthdate(String birthdate) { + this.birthdate = birthdate; + } + + /** * Parse a JsonObject into a UserInfo. * @param o * @return @@ -362,6 +378,7 @@ public class DefaultUserInfo implements UserInfo { ui.setZoneinfo(obj.has("zone_info") ? obj.get("zone_info").getAsString() : null); ui.setLocale(obj.has("locale") ? obj.get("locale").getAsString() : null); ui.setUpdatedTime(obj.has("updated_time") ? obj.get("updated_time").getAsString() : null); + ui.setBirthdate(obj.has("birthdate") ? obj.get("birthdate").getAsString() : null); ui.setEmail(obj.has("email") ? obj.get("email").getAsString() : null); ui.setEmailVerified(obj.has("email_verified") ? obj.get("email_verified").getAsBoolean() : null); @@ -386,4 +403,5 @@ public class DefaultUserInfo implements UserInfo { return ui; } + } diff --git a/openid-connect-common/src/main/java/org/mitre/openid/connect/model/UserInfo.java b/openid-connect-common/src/main/java/org/mitre/openid/connect/model/UserInfo.java index 54a7cbe2d..ca5a2dca4 100644 --- a/openid-connect-common/src/main/java/org/mitre/openid/connect/model/UserInfo.java +++ b/openid-connect-common/src/main/java/org/mitre/openid/connect/model/UserInfo.java @@ -221,4 +221,18 @@ public interface UserInfo { */ public abstract void setUpdatedTime(String updatedTime); + + /** + * + * @return + */ + @Basic + @Column(name="birthdate") + public abstract String getBirthdate(); + + /** + * + * @param birthdate + */ + public abstract void setBirthdate(String birthdate); } \ No newline at end of file diff --git a/openid-connect-server/src/main/java/org/mitre/openid/connect/view/JSONUserInfoView.java b/openid-connect-server/src/main/java/org/mitre/openid/connect/view/JSONUserInfoView.java index f90ed82df..bbcbfaa1c 100644 --- a/openid-connect-server/src/main/java/org/mitre/openid/connect/view/JSONUserInfoView.java +++ b/openid-connect-server/src/main/java/org/mitre/openid/connect/view/JSONUserInfoView.java @@ -107,6 +107,7 @@ public class JSONUserInfoView extends AbstractView { obj.addProperty("zone_info", ui.getZoneinfo()); obj.addProperty("locale", ui.getLocale()); obj.addProperty("updated_time", ui.getUpdatedTime()); + obj.addProperty("birthdate", ui.getBirthdate()); } if (scope.contains("email")) { diff --git a/openid-connect-server/src/main/resources/db/tables/hsql_database_tables.sql b/openid-connect-server/src/main/resources/db/tables/hsql_database_tables.sql index 2fae51935..0b7d7e924 100644 --- a/openid-connect-server/src/main/resources/db/tables/hsql_database_tables.sql +++ b/openid-connect-server/src/main/resources/db/tables/hsql_database_tables.sql @@ -179,7 +179,8 @@ CREATE TABLE IF NOT EXISTS user_info ( locale VARCHAR(256), phone_number VARCHAR(256), address_id VARCHAR(256), - updated_time VARCHAR(256) + updated_time VARCHAR(256), + birthdate VARCHAR(256) ); CREATE TABLE IF NOT EXISTS whitelisted_site ( diff --git a/openid-connect-server/src/main/resources/db/tables/loading_temp_tables.sql b/openid-connect-server/src/main/resources/db/tables/loading_temp_tables.sql index c18592567..3f2e60cc6 100644 --- a/openid-connect-server/src/main/resources/db/tables/loading_temp_tables.sql +++ b/openid-connect-server/src/main/resources/db/tables/loading_temp_tables.sql @@ -32,7 +32,8 @@ CREATE TEMPORARY TABLE IF NOT EXISTS user_info_TEMP ( locale VARCHAR(256), phone_number VARCHAR(256), address_id VARCHAR(256), - updated_time VARCHAR(256) + updated_time VARCHAR(256), + birthdate VARCHAR(256) ); CREATE TEMPORARY TABLE IF NOT EXISTS client_details_TEMP ( diff --git a/openid-connect-server/src/main/resources/db/tables/mysql_database_tables.sql b/openid-connect-server/src/main/resources/db/tables/mysql_database_tables.sql index c08ead3c9..b1da613a8 100644 --- a/openid-connect-server/src/main/resources/db/tables/mysql_database_tables.sql +++ b/openid-connect-server/src/main/resources/db/tables/mysql_database_tables.sql @@ -174,7 +174,8 @@ CREATE TABLE user_info ( locale VARCHAR(256), phone_number VARCHAR(256), address_id VARCHAR(256), - updated_time VARCHAR(256) + updated_time VARCHAR(256), + birthdate VARCHAR(256) ); CREATE TABLE whitelisted_site (