added resource set class

pull/708/merge
Justin Richer 2015-02-23 11:28:21 -05:00
parent b670f44138
commit 071ea579a3
3 changed files with 184 additions and 3 deletions

View File

@ -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<SystemScope> reservedScopes =
Sets.newHashSet(

View File

@ -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<String> 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<String> getScopes() {
return scopes;
}
/**
* @param scopes the scopes to set
*/
public void setScopes(Set<String> 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;
}
}

View File

@ -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)
);