diff --git a/openid-connect-common/src/main/java/org/mitre/oauth2/model/SystemScope.java b/openid-connect-common/src/main/java/org/mitre/oauth2/model/SystemScope.java new file mode 100644 index 000000000..efa8fa3d5 --- /dev/null +++ b/openid-connect-common/src/main/java/org/mitre/oauth2/model/SystemScope.java @@ -0,0 +1,124 @@ +/** + * + */ +package org.mitre.oauth2.model; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.Table; + +/** + * @author jricher + * + */ +@Entity +@Table(name = "system_scope") +@NamedQueries({ + @NamedQuery(name = "SystemScope.findAll", query = "select s from SystemScope s"), + @NamedQuery(name = "SystemScope.getByValue", query = "select s from SystemScope s WHERE value = :value") +}) +public class SystemScope { + + private Long id; + private String value; // scope value + private String description; // human-readable description + private String icon; // class of the icon to display on the auth page + private boolean allowDynReg; // can a dynamically registered client ask for this scope? + private boolean defaultScope; // is this a default scope for newly-registered clients? + + /** + * @return the id + */ + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + public Long getId() { + return id; + } + /** + * @param id the id to set + */ + public void setId(Long id) { + this.id = id; + } + /** + * @return the value + */ + @Basic + @Column(name = "scope") + public String getValue() { + return value; + } + /** + * @param value the value to set + */ + public void setValue(String value) { + this.value = value; + } + /** + * @return the description + */ + @Basic + @Column(name = "description") + public String getDescription() { + return description; + } + /** + * @param description the description to set + */ + public void setDescription(String description) { + this.description = description; + } + /** + * @return the icon + */ + @Basic + @Column(name = "icon") + public String getIcon() { + return icon; + } + /** + * @param icon the icon to set + */ + public void setIcon(String icon) { + this.icon = icon; + } + /** + * @return the allowDynReg + */ + @Basic + @Column(name = "allow_dyn_reg") + public boolean isAllowDynReg() { + return allowDynReg; + } + /** + * @param allowDynReg the allowDynReg to set + */ + public void setAllowDynReg(boolean allowDynReg) { + this.allowDynReg = allowDynReg; + } + + /** + * @return the defaultScope + */ + @Basic + @Column(name = "default_scope") + public boolean isDefaultScope() { + return defaultScope; + } + /** + * @param defaultScope the defaultScope to set + */ + public void setDefaultScope(boolean defaultScope) { + this.defaultScope = defaultScope; + } + + + +} 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 6a472eec4..d8be6f08b 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 @@ -160,6 +160,15 @@ CREATE TABLE IF NOT EXISTS token_scope ( scope VARCHAR(2048) ); +CREATE TABLE IF NOT EXISTS site_scope ( + id BIGINT GENERATED BY DFAULT AS IDENTITY(START WITH 1) PRIMARY KEY, + scope VARCHAR(1024), + description VARCHAR(4096), + icon VARCHAR(256), + allow_dyn_reg BOOLEAN, + default_scope BOOLEAN +); + CREATE TABLE IF NOT EXISTS user_info ( id BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) PRIMARY KEY, sub VARCHAR(256), 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 7dafd2a44..41f807f58 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 @@ -155,6 +155,15 @@ CREATE TABLE token_scope ( scope VARCHAR(2048) ); +CREATE TABLE IF NOT EXISTS site_scope ( + id BIGINT AUTO_INCREMENT PRIMARY KEY, + scope VARCHAR(1024), + description VARCHAR(4096), + icon VARCHAR(256), + allow_dyn_reg BOOLEAN, + default_scope BOOLEAN +); + CREATE TABLE user_info ( id BIGINT AUTO_INCREMENT PRIMARY KEY, sub VARCHAR(256),