diff --git a/openid-connect-common/src/main/java/org/mitre/oauth2/service/SystemScopeService.java b/openid-connect-common/src/main/java/org/mitre/oauth2/service/SystemScopeService.java index 4d2f35d30..11ac30987 100644 --- a/openid-connect-common/src/main/java/org/mitre/oauth2/service/SystemScopeService.java +++ b/openid-connect-common/src/main/java/org/mitre/oauth2/service/SystemScopeService.java @@ -33,9 +33,10 @@ public interface SystemScopeService { public static final String OFFLINE_ACCESS = "offline_access"; public static final Object OPENID_SCOPE = "openid"; - public static final String ID_TOKEN_SCOPE = "id-token"; - public static final String REGISTRATION_TOKEN_SCOPE = "registration-token"; - public static final String RESOURCE_TOKEN_SCOPE = "resource-token"; + public static final String ID_TOKEN_SCOPE = "id-token"; // ID tokens are generated using this scope + public static final String REGISTRATION_TOKEN_SCOPE = "registration-token"; // this scope manages dynamic client registrations + public static final String RESOURCE_TOKEN_SCOPE = "resource-token"; // this scope manages client-style protected resources + public static final String RESOURCE_SET_REGISTRATION_SCOPE = "resource-set-registration"; public static final Set reservedScopes = Sets.newHashSet( diff --git a/openid-connect-common/src/main/java/org/mitre/openid/connect/model/ResourceSet.java b/openid-connect-common/src/main/java/org/mitre/openid/connect/model/ResourceSet.java new file mode 100644 index 000000000..c62d88fd4 --- /dev/null +++ b/openid-connect-common/src/main/java/org/mitre/openid/connect/model/ResourceSet.java @@ -0,0 +1,166 @@ +package org.mitre.openid.connect.model; + +import java.util.Set; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.CollectionTable; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +import org.mitre.oauth2.model.SystemScope; + +@Entity +@Table(name = "resource_set") +public class ResourceSet { + + private Long id; + private String name; + private String uri; + private String type; + private Set scopes; + private String iconUri; + + private String policyUri; + + private String owner; // username of the person responsible for the reigistration (either directly or via OAuth token) + + /** + * @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 name + */ + @Basic + @Column(name = "name") + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the uri + */ + @Basic + @Column(name = "uri") + public String getUri() { + return uri; + } + + /** + * @param uri the uri to set + */ + public void setUri(String uri) { + this.uri = uri; + } + + /** + * @return the type + */ + @Basic + @Column(name = "type") + public String getType() { + return type; + } + + /** + * @param type the type to set + */ + public void setType(String type) { + this.type = type; + } + + /** + * @return the scopes + */ + @OneToMany(fetch=FetchType.EAGER) + @CollectionTable( + name="resource_set_scope", + joinColumns=@JoinColumn(name="owner_id") + ) + public Set getScopes() { + return scopes; + } + + /** + * @param scopes the scopes to set + */ + public void setScopes(Set scopes) { + this.scopes = scopes; + } + + /** + * @return the iconUri + */ + @Basic + @Column(name = "icon_uri") + public String getIconUri() { + return iconUri; + } + + /** + * @param iconUri the iconUri to set + */ + public void setIconUri(String iconUri) { + this.iconUri = iconUri; + } + + @Basic + @Column(name = "policy_uri") + public String getPolicyUri() { + return this.policyUri; + } + + public void setPolicyUri(String policyUri) { + this.policyUri = policyUri; + } + + /** + * @return the owner + */ + @Basic + @Column(name = "owner") + public String getOwner() { + return owner; + } + + /** + * @param owner the owner to set + */ + public void setOwner(String owner) { + this.owner = owner; + } + + + + + +} diff --git a/openid-connect-server-webapp/src/main/resources/db/tables/hsql_database_tables.sql b/openid-connect-server-webapp/src/main/resources/db/tables/hsql_database_tables.sql index ea932fec3..26c96a384 100644 --- a/openid-connect-server-webapp/src/main/resources/db/tables/hsql_database_tables.sql +++ b/openid-connect-server-webapp/src/main/resources/db/tables/hsql_database_tables.sql @@ -218,3 +218,17 @@ CREATE TABLE IF NOT EXISTS pairwise_identifier ( sub VARCHAR(256), sector_identifier VARCHAR(2048) ); + +CREATE TABLE IF NOT EXISTS resource_set ( + id BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITHP 1) PRIMARY KEY, + name VARCHAR(1024), + uri VARCHAR(1024), + icon_uri VARCHAR(1024), + policy_uri VARCHAR(1024), + owner VARCHAR(256) +); + +CREATE TABLE IF NOT EXISTS resource_set_scope ( + owner_id BIGINT, + scope VARCHAR(256) +); \ No newline at end of file