added site scope

pull/306/merge
Justin Richer 2013-01-30 17:47:16 -05:00
parent a2e548c261
commit a3619240e6
3 changed files with 142 additions and 0 deletions

View File

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

View File

@ -160,6 +160,15 @@ CREATE TABLE IF NOT EXISTS token_scope (
scope VARCHAR(2048) 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 ( CREATE TABLE IF NOT EXISTS user_info (
id BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) PRIMARY KEY, id BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) PRIMARY KEY,
sub VARCHAR(256), sub VARCHAR(256),

View File

@ -155,6 +155,15 @@ CREATE TABLE token_scope (
scope VARCHAR(2048) 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 ( CREATE TABLE user_info (
id BIGINT AUTO_INCREMENT PRIMARY KEY, id BIGINT AUTO_INCREMENT PRIMARY KEY,
sub VARCHAR(256), sub VARCHAR(256),