updated some entity annotations

pull/59/head
Justin Richer 13 years ago
parent 4db5d50864
commit 20f74269e1

@ -1,10 +1,14 @@
package org.mitre.openid.connect.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity
public class Address {
private Long id;
private String formatted;
private String street_address;
private String locality;
@ -12,6 +16,8 @@ public class Address {
private String postal_code;
private String country;
/**
* @return the formatted
*/
@ -85,4 +91,20 @@ public class Address {
this.country = country;
}
/**
* @return the id
*/
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
public Long getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Long id) {
this.id = id;
}
}

@ -8,6 +8,8 @@ import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;
import org.springframework.security.oauth2.provider.ClientDetails;
@ -48,7 +50,7 @@ public class ApprovedSite {
* @return the id
*/
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@GeneratedValue(strategy = GenerationType.IDENTITY)
public Long getId() {
return id;
}
@ -63,6 +65,7 @@ public class ApprovedSite {
/**
* @return the userInfo
*/
@ManyToOne
public UserInfo getUserInfo() {
return userInfo;
}
@ -123,6 +126,7 @@ public class ApprovedSite {
/**
* @return the allowedScopes
*/
@OneToMany
public Collection<String> getAllowedScopes() {
return allowedScopes;
}

@ -2,7 +2,12 @@ package org.mitre.openid.connect.model;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Temporal;
/**
* Class to contain a logged event in the system.
@ -20,4 +25,45 @@ public class Event {
private EventType type;
private Date timestamp;
/**
* @return the id
*/
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
public Long getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Long id) {
this.id = id;
}
/**
* @return the type
*/
public EventType getType() {
return type;
}
/**
* @param type the type to set
*/
public void setType(EventType type) {
this.type = type;
}
/**
* @return the timestamp
*/
@Basic
@Temporal(javax.persistence.TemporalType.TIMESTAMP)
public Date getTimestamp() {
return timestamp;
}
/**
* @param timestamp the timestamp to set
*/
public void setTimestamp(Date timestamp) {
this.timestamp = timestamp;
}
}

@ -1,105 +1,51 @@
package org.mitre.openid.connect.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import org.mitre.jwt.model.Jwt;
import org.mitre.jwt.model.JwtClaims;
/*
* TODO: This class needs to be encoded as a JWT
*/
@Entity
public class IdToken extends Jwt {
public class IdToken extends JwtClaims {
public static final String USER_ID = "user_id";
public static final String ISO29115 = "iso29115";
public static final String NONCE = "nonce";
public static final String AUTH_TIME = "auth_time";
private Long id;
private String iss;
private String user_id;
private String aud;
private String exp;
private String iso29115;
private String nonce;
private String auth_time;
/**
* @return the iss
*/
public String getIss() {
return iss;
}
/**
* @param iss the iss to set
*/
public void setIss(String iss) {
this.iss = iss;
}
/**
* @return the user_id
*/
public String getUser_id() {
return user_id;
}
/**
* @param user_id the user_id to set
*/
public void setUser_id(String user_id) {
this.user_id = user_id;
}
/**
* @return the aud
*/
public String getAud() {
return aud;
}
/**
* @param aud the aud to set
*/
public void setAud(String aud) {
this.aud = aud;
}
/**
* @return the exp
*/
public String getExp() {
return exp;
}
/**
* @param exp the exp to set
*/
public void setExp(String exp) {
this.exp = exp;
}
/**
* @return the iso29115
*/
public String getIso29115() {
return iso29115;
}
/**
* @param iso29115 the iso29115 to set
*/
public void setIso29115(String iso29115) {
this.iso29115 = iso29115;
}
/**
* @return the nonce
*/
public String getNonce() {
return nonce;
}
/**
* @param nonce the nonce to set
*/
public void setNonce(String nonce) {
this.nonce = nonce;
}
/**
* @return the auth_time
*/
public String getAuth_time() {
return auth_time;
* @return the id
*/
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
public Long getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Long id) {
this.id = id;
}
public String getUserId() {
return getClaimAsString(USER_ID);
}
/**
* @param auth_time the auth_time to set
*/
public void setAuth_time(String auth_time) {
this.auth_time = auth_time;
public void setUserId(String user_id) {
setClaim(USER_ID, user_id);
}
// TODO: add in other fields
}

@ -1,6 +1,7 @@
package org.mitre.openid.connect.model;
import javax.persistence.Entity;
import javax.persistence.Id;
@Entity
public class UserInfo {
@ -29,6 +30,7 @@ public class UserInfo {
/**
* @return the user_id
*/
@Id
public String getUser_id() {
return user_id;
}

@ -6,6 +6,7 @@ import java.util.Date;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import org.springframework.security.oauth2.provider.ClientDetails;
@ -19,7 +20,7 @@ public class WhitelistedSite {
// unique id
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
// who added this site to the whitelist (should be an admin)
@ -30,5 +31,6 @@ public class WhitelistedSite {
// what scopes be allowed by default
// this should include all information for what data to access
@ManyToOne
private Collection<String> allowedScopes;
}

Loading…
Cancel
Save