It deploys! Finished adding persistence annotations to the model setup we have so far. Added IdToken.java, which extends JWT and uses an IdTokenClaims as its JWT.claims object.
parent
6cce82f484
commit
b47d22e0fd
|
@ -270,6 +270,11 @@ public class ClientDetailsEntity implements ClientDetails {
|
||||||
/**
|
/**
|
||||||
* @return the resourceIds
|
* @return the resourceIds
|
||||||
*/
|
*/
|
||||||
|
@ElementCollection(fetch = FetchType.EAGER)
|
||||||
|
@CollectionTable(
|
||||||
|
name="resource_ids",
|
||||||
|
joinColumns=@JoinColumn(name="owner_id")
|
||||||
|
)
|
||||||
public Set<String> getResourceIds() {
|
public Set<String> getResourceIds() {
|
||||||
return resourceIds;
|
return resourceIds;
|
||||||
}
|
}
|
||||||
|
@ -277,11 +282,6 @@ public class ClientDetailsEntity implements ClientDetails {
|
||||||
/**
|
/**
|
||||||
* @param resourceIds the resourceIds to set
|
* @param resourceIds the resourceIds to set
|
||||||
*/
|
*/
|
||||||
@ElementCollection(fetch = FetchType.EAGER)
|
|
||||||
@CollectionTable(
|
|
||||||
name="resource_ids",
|
|
||||||
joinColumns=@JoinColumn(name="owner_id")
|
|
||||||
)
|
|
||||||
public void setResourceIds(Set<String> resourceIds) {
|
public void setResourceIds(Set<String> resourceIds) {
|
||||||
this.resourceIds = resourceIds;
|
this.resourceIds = resourceIds;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,26 +9,13 @@ import javax.persistence.Id;
|
||||||
@Entity
|
@Entity
|
||||||
public class Address {
|
public class Address {
|
||||||
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Basic
|
|
||||||
private String formatted;
|
private String formatted;
|
||||||
|
private String streetAddress;
|
||||||
@Basic
|
|
||||||
private String street_address;
|
|
||||||
|
|
||||||
@Basic
|
|
||||||
private String locality;
|
private String locality;
|
||||||
|
|
||||||
@Basic
|
|
||||||
private String region;
|
private String region;
|
||||||
|
private String postalCode;
|
||||||
@Basic
|
|
||||||
private String postal_code;
|
|
||||||
|
|
||||||
@Basic
|
|
||||||
private String country;
|
private String country;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -41,6 +28,7 @@ public class Address {
|
||||||
/**
|
/**
|
||||||
* @return the formatted address string
|
* @return the formatted address string
|
||||||
*/
|
*/
|
||||||
|
@Basic
|
||||||
public String getFormatted() {
|
public String getFormatted() {
|
||||||
return formatted;
|
return formatted;
|
||||||
}
|
}
|
||||||
|
@ -51,20 +39,22 @@ public class Address {
|
||||||
this.formatted = formatted;
|
this.formatted = formatted;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @return the street_address
|
* @return the streetAddress
|
||||||
*/
|
*/
|
||||||
public String getStreet_address() {
|
@Basic
|
||||||
return street_address;
|
public String getStreetAddress() {
|
||||||
|
return streetAddress;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param street_address the street_address to set
|
* @param streetAddress the streetAddress to set
|
||||||
*/
|
*/
|
||||||
public void setStreet_address(String street_address) {
|
public void setStreetAddress(String streetAddress) {
|
||||||
this.street_address = street_address;
|
this.streetAddress = streetAddress;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @return the locality
|
* @return the locality
|
||||||
*/
|
*/
|
||||||
|
@Basic
|
||||||
public String getLocality() {
|
public String getLocality() {
|
||||||
return locality;
|
return locality;
|
||||||
}
|
}
|
||||||
|
@ -77,6 +67,7 @@ public class Address {
|
||||||
/**
|
/**
|
||||||
* @return the region
|
* @return the region
|
||||||
*/
|
*/
|
||||||
|
@Basic
|
||||||
public String getRegion() {
|
public String getRegion() {
|
||||||
return region;
|
return region;
|
||||||
}
|
}
|
||||||
|
@ -87,20 +78,22 @@ public class Address {
|
||||||
this.region = region;
|
this.region = region;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @return the postal_code
|
* @return the postalCode
|
||||||
*/
|
*/
|
||||||
public String getPostal_code() {
|
@Basic
|
||||||
return postal_code;
|
public String getPostalCode() {
|
||||||
|
return postalCode;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param postal_code the postal_code to set
|
* @param postalCode the postalCode to set
|
||||||
*/
|
*/
|
||||||
public void setPostal_code(String postal_code) {
|
public void setPostalCode(String postalCode) {
|
||||||
this.postal_code = postal_code;
|
this.postalCode = postalCode;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @return the country
|
* @return the country
|
||||||
*/
|
*/
|
||||||
|
@Basic
|
||||||
public String getCountry() {
|
public String getCountry() {
|
||||||
return country;
|
return country;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,57 +1,55 @@
|
||||||
package org.mitre.openid.connect.model;
|
package org.mitre.openid.connect.model;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.persistence.Basic;
|
import javax.persistence.Basic;
|
||||||
|
import javax.persistence.CollectionTable;
|
||||||
|
import javax.persistence.ElementCollection;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.FetchType;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.GenerationType;
|
import javax.persistence.GenerationType;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.JoinColumn;
|
import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
import javax.persistence.OneToMany;
|
import javax.persistence.NamedQueries;
|
||||||
|
import javax.persistence.NamedQuery;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.persistence.Temporal;
|
import javax.persistence.Temporal;
|
||||||
import javax.persistence.TemporalType;
|
|
||||||
|
|
||||||
import org.springframework.security.oauth2.provider.ClientDetails;
|
import org.mitre.oauth2.model.ClientDetailsEntity;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="approvedsite")
|
@Table(name="approvedsite")
|
||||||
|
@NamedQueries({
|
||||||
|
@NamedQuery(name = "ApprovedSite.getAll", query = "select a from ApprovedSite a"),
|
||||||
|
@NamedQuery(name = "ApprovedSite.getByUserInfo", query = "select a from ApprovedSite a if a.userInfo = :approvedSiteUserInfo"),
|
||||||
|
@NamedQuery(name = "ApprovedSite.getByClientDetails", query = "select a from approvedSite if a.clientDetails = :approvedSiteClientDetails")
|
||||||
|
})
|
||||||
public class ApprovedSite {
|
public class ApprovedSite {
|
||||||
|
|
||||||
// unique id
|
// unique id
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
// which user made the approval
|
// which user made the approval
|
||||||
@ManyToOne
|
|
||||||
@JoinColumn(name="userinfo_id")
|
|
||||||
private UserInfo userInfo;
|
private UserInfo userInfo;
|
||||||
|
|
||||||
// which OAuth2 client is this tied to
|
// which OAuth2 client is this tied to
|
||||||
@ManyToOne
|
private ClientDetailsEntity clientDetails;
|
||||||
@JoinColumn(name="clientdetails_id")
|
|
||||||
private ClientDetails clientDetails;
|
|
||||||
|
|
||||||
// when was this first approved?
|
// when was this first approved?
|
||||||
@Temporal(TemporalType.DATE)
|
|
||||||
private Date creationDate;
|
private Date creationDate;
|
||||||
|
|
||||||
// when was this last accessed?
|
// when was this last accessed?
|
||||||
@Temporal(TemporalType.DATE)
|
|
||||||
private Date accessDate;
|
private Date accessDate;
|
||||||
|
|
||||||
// if this is a time-limited access, when does it run out?
|
// if this is a time-limited access, when does it run out?
|
||||||
@Temporal(TemporalType.DATE)
|
|
||||||
private Date timeoutDate;
|
private Date timeoutDate;
|
||||||
|
|
||||||
// what scopes have been allowed
|
// what scopes have been allowed
|
||||||
// this should include all information for what data to access
|
// this should include all information for what data to access
|
||||||
@OneToMany(mappedBy = "approvedsite")
|
private Set<String> allowedScopes;
|
||||||
private Collection<String> allowedScopes;
|
|
||||||
|
|
||||||
// TODO: should we store the OAuth2 tokens and IdTokens here?
|
// TODO: should we store the OAuth2 tokens and IdTokens here?
|
||||||
|
|
||||||
|
@ -82,6 +80,7 @@ public class ApprovedSite {
|
||||||
* @return the userInfo
|
* @return the userInfo
|
||||||
*/
|
*/
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
|
@JoinColumn(name="userinfo_id")
|
||||||
public UserInfo getUserInfo() {
|
public UserInfo getUserInfo() {
|
||||||
return userInfo;
|
return userInfo;
|
||||||
}
|
}
|
||||||
|
@ -96,14 +95,16 @@ public class ApprovedSite {
|
||||||
/**
|
/**
|
||||||
* @return the clientDetails
|
* @return the clientDetails
|
||||||
*/
|
*/
|
||||||
public ClientDetails getClientDetails() {
|
@ManyToOne
|
||||||
|
@JoinColumn(name="clientdetails_id")
|
||||||
|
public ClientDetailsEntity getClientDetails() {
|
||||||
return clientDetails;
|
return clientDetails;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param clientDetails the clientDetails to set
|
* @param clientDetails the clientDetails to set
|
||||||
*/
|
*/
|
||||||
public void setClientDetails(ClientDetails clientDetails) {
|
public void setClientDetails(ClientDetailsEntity clientDetails) {
|
||||||
this.clientDetails = clientDetails;
|
this.clientDetails = clientDetails;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,15 +143,15 @@ public class ApprovedSite {
|
||||||
/**
|
/**
|
||||||
* @return the allowedScopes
|
* @return the allowedScopes
|
||||||
*/
|
*/
|
||||||
@OneToMany
|
@ElementCollection(fetch = FetchType.EAGER)
|
||||||
public Collection<String> getAllowedScopes() {
|
public Set<String> getAllowedScopes() {
|
||||||
return allowedScopes;
|
return allowedScopes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param allowedScopes the allowedScopes to set
|
* @param allowedScopes the allowedScopes to set
|
||||||
*/
|
*/
|
||||||
public void setAllowedScopes(Collection<String> allowedScopes) {
|
public void setAllowedScopes(Set<String> allowedScopes) {
|
||||||
this.allowedScopes = allowedScopes;
|
this.allowedScopes = allowedScopes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.GenerationType;
|
import javax.persistence.GenerationType;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Table;
|
||||||
import javax.persistence.Temporal;
|
import javax.persistence.Temporal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -17,6 +18,7 @@ import javax.persistence.Temporal;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
@Table(name="event")
|
||||||
public class Event {
|
public class Event {
|
||||||
|
|
||||||
public static enum EventType { LOGIN, AUTHORIZATION, ACCESS }
|
public static enum EventType { LOGIN, AUTHORIZATION, ACCESS }
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
package org.mitre.openid.connect.model;
|
||||||
|
|
||||||
|
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;
|
||||||
|
import javax.persistence.Transient;
|
||||||
|
|
||||||
|
import org.mitre.jwt.model.Jwt;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name="idtoken")
|
||||||
|
@NamedQueries({
|
||||||
|
@NamedQuery(name = "IdToken.getAll", query = "select i from IdToken i")
|
||||||
|
})
|
||||||
|
public class IdToken extends Jwt {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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 tokenClaims
|
||||||
|
*/
|
||||||
|
@Transient
|
||||||
|
public IdTokenClaims getTokenClaims() {
|
||||||
|
return (IdTokenClaims) super.getClaims();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param tokenClaims the tokenClaims to set
|
||||||
|
*/
|
||||||
|
public void setTokenClaims(IdTokenClaims tokenClaims) {
|
||||||
|
super.setClaims(tokenClaims);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -6,14 +6,14 @@ import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.GenerationType;
|
import javax.persistence.GenerationType;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import javax.persistence.Transient;
|
||||||
|
|
||||||
import org.mitre.jwt.model.Jwt;
|
|
||||||
import org.mitre.jwt.model.JwtClaims;
|
import org.mitre.jwt.model.JwtClaims;
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: This class needs to be encoded as a JWT
|
|
||||||
*/
|
|
||||||
@Entity
|
@Entity
|
||||||
|
@Table(name="idtokenclaims")
|
||||||
public class IdTokenClaims extends JwtClaims {
|
public class IdTokenClaims extends JwtClaims {
|
||||||
|
|
||||||
public static final String USER_ID = "user_id";
|
public static final String USER_ID = "user_id";
|
||||||
|
@ -38,7 +38,7 @@ public class IdTokenClaims extends JwtClaims {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transient
|
||||||
public String getUserId() {
|
public String getUserId() {
|
||||||
return getClaimAsString(USER_ID);
|
return getClaimAsString(USER_ID);
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ public class IdTokenClaims extends JwtClaims {
|
||||||
setClaim(USER_ID, user_id);
|
setClaim(USER_ID, user_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transient
|
||||||
public String getAuthContext() {
|
public String getAuthContext() {
|
||||||
return getClaimAsString(AUTHENTICATION_CONTEXT_CLASS_REFERENCE);
|
return getClaimAsString(AUTHENTICATION_CONTEXT_CLASS_REFERENCE);
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ public class IdTokenClaims extends JwtClaims {
|
||||||
setClaim(AUTHENTICATION_CONTEXT_CLASS_REFERENCE, acr);
|
setClaim(AUTHENTICATION_CONTEXT_CLASS_REFERENCE, acr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transient
|
||||||
public String getNonce() {
|
public String getNonce() {
|
||||||
return getClaimAsString(NONCE);
|
return getClaimAsString(NONCE);
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ public class IdTokenClaims extends JwtClaims {
|
||||||
setClaim(NONCE, nonce);
|
setClaim(NONCE, nonce);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transient
|
||||||
public Date getAuthTime() {
|
public Date getAuthTime() {
|
||||||
return getClaimAsDate(AUTH_TIME);
|
return getClaimAsDate(AUTH_TIME);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,86 +2,55 @@ package org.mitre.openid.connect.model;
|
||||||
|
|
||||||
import javax.persistence.Basic;
|
import javax.persistence.Basic;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
|
||||||
import javax.persistence.GenerationType;
|
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.NamedQueries;
|
||||||
|
import javax.persistence.NamedQuery;
|
||||||
import javax.persistence.OneToOne;
|
import javax.persistence.OneToOne;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="userinfo")
|
@Table(name="userinfo")
|
||||||
|
@NamedQueries({
|
||||||
|
@NamedQuery(name="UserInfo.getAll", query = "select u from UserInfo u")
|
||||||
|
})
|
||||||
public class UserInfo {
|
public class UserInfo {
|
||||||
|
|
||||||
// unique object id for persistence
|
private String userId;
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
// TODO: underbars are awkward in java, should we switch all this to camel case and put in underbars in the serialization view?
|
|
||||||
@Basic
|
|
||||||
private String user_id;
|
|
||||||
@Basic
|
|
||||||
private String name;
|
private String name;
|
||||||
@Basic
|
private String givenName;
|
||||||
private String given_name;
|
private String familyName;
|
||||||
@Basic
|
private String middleName;
|
||||||
private String family_name;
|
|
||||||
@Basic
|
|
||||||
private String middle_name;
|
|
||||||
@Basic
|
|
||||||
private String nickname;
|
private String nickname;
|
||||||
@Basic
|
|
||||||
private String profile;
|
private String profile;
|
||||||
@Basic
|
|
||||||
private String picture;
|
private String picture;
|
||||||
@Basic
|
|
||||||
private String website;
|
private String website;
|
||||||
@Basic
|
|
||||||
private String email;
|
private String email;
|
||||||
@Basic
|
|
||||||
private Boolean verified;
|
private Boolean verified;
|
||||||
@Basic
|
|
||||||
private String gender;
|
private String gender;
|
||||||
@Basic
|
|
||||||
private String zoneinfo;
|
private String zoneinfo;
|
||||||
@Basic
|
|
||||||
private String locale;
|
private String locale;
|
||||||
@Basic
|
private String phoneNumber;
|
||||||
private String phone_number;
|
|
||||||
@OneToOne
|
|
||||||
private Address address;
|
private Address address;
|
||||||
@Basic
|
private String updatedTime;
|
||||||
private String updated_time;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the id
|
* @return the userId
|
||||||
*/
|
|
||||||
public Long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param id the id to set
|
|
||||||
*/
|
|
||||||
public void setId(Long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @return the user_id
|
|
||||||
*/
|
*/
|
||||||
@Id
|
@Id
|
||||||
public String getUser_id() {
|
public String getUserId() {
|
||||||
return user_id;
|
return userId;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param user_id the user_id to set
|
* @param userId the userId to set
|
||||||
*/
|
*/
|
||||||
public void setUser_id(String user_id) {
|
public void setUserId(String userId) {
|
||||||
this.user_id = user_id;
|
this.userId = userId;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @return the name
|
* @return the name
|
||||||
*/
|
*/
|
||||||
|
@Basic
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
@ -92,44 +61,48 @@ public class UserInfo {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @return the given_name
|
* @return the givenName
|
||||||
*/
|
*/
|
||||||
public String getGiven_name() {
|
@Basic
|
||||||
return given_name;
|
public String getGivenName() {
|
||||||
|
return givenName;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param given_name the given_name to set
|
* @param givenName the givenName to set
|
||||||
*/
|
*/
|
||||||
public void setGiven_name(String given_name) {
|
public void setGivenName(String givenName) {
|
||||||
this.given_name = given_name;
|
this.givenName = givenName;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @return the family_name
|
* @return the familyName
|
||||||
*/
|
*/
|
||||||
public String getFamily_name() {
|
@Basic
|
||||||
return family_name;
|
public String getFamilyName() {
|
||||||
|
return familyName;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param family_name the family_name to set
|
* @param familyName the familyName to set
|
||||||
*/
|
*/
|
||||||
public void setFamily_name(String family_name) {
|
public void setFamilyName(String familyName) {
|
||||||
this.family_name = family_name;
|
this.familyName = familyName;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @return the middle_name
|
* @return the middleName
|
||||||
*/
|
*/
|
||||||
public String getMiddle_name() {
|
@Basic
|
||||||
return middle_name;
|
public String getMiddleName() {
|
||||||
|
return middleName;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param middle_name the middle_name to set
|
* @param middleName the middleName to set
|
||||||
*/
|
*/
|
||||||
public void setMiddle_name(String middle_name) {
|
public void setMiddleName(String middleName) {
|
||||||
this.middle_name = middle_name;
|
this.middleName = middleName;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @return the nickname
|
* @return the nickname
|
||||||
*/
|
*/
|
||||||
|
@Basic
|
||||||
public String getNickname() {
|
public String getNickname() {
|
||||||
return nickname;
|
return nickname;
|
||||||
}
|
}
|
||||||
|
@ -142,6 +115,7 @@ public class UserInfo {
|
||||||
/**
|
/**
|
||||||
* @return the profile
|
* @return the profile
|
||||||
*/
|
*/
|
||||||
|
@Basic
|
||||||
public String getProfile() {
|
public String getProfile() {
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
@ -154,6 +128,7 @@ public class UserInfo {
|
||||||
/**
|
/**
|
||||||
* @return the picture
|
* @return the picture
|
||||||
*/
|
*/
|
||||||
|
@Basic
|
||||||
public String getPicture() {
|
public String getPicture() {
|
||||||
return picture;
|
return picture;
|
||||||
}
|
}
|
||||||
|
@ -166,6 +141,7 @@ public class UserInfo {
|
||||||
/**
|
/**
|
||||||
* @return the website
|
* @return the website
|
||||||
*/
|
*/
|
||||||
|
@Basic
|
||||||
public String getWebsite() {
|
public String getWebsite() {
|
||||||
return website;
|
return website;
|
||||||
}
|
}
|
||||||
|
@ -178,6 +154,7 @@ public class UserInfo {
|
||||||
/**
|
/**
|
||||||
* @return the email
|
* @return the email
|
||||||
*/
|
*/
|
||||||
|
@Basic
|
||||||
public String getEmail() {
|
public String getEmail() {
|
||||||
return email;
|
return email;
|
||||||
}
|
}
|
||||||
|
@ -190,6 +167,7 @@ public class UserInfo {
|
||||||
/**
|
/**
|
||||||
* @return the verified
|
* @return the verified
|
||||||
*/
|
*/
|
||||||
|
@Basic
|
||||||
public Boolean getVerified() {
|
public Boolean getVerified() {
|
||||||
return verified;
|
return verified;
|
||||||
}
|
}
|
||||||
|
@ -202,6 +180,7 @@ public class UserInfo {
|
||||||
/**
|
/**
|
||||||
* @return the gender
|
* @return the gender
|
||||||
*/
|
*/
|
||||||
|
@Basic
|
||||||
public String getGender() {
|
public String getGender() {
|
||||||
return gender;
|
return gender;
|
||||||
}
|
}
|
||||||
|
@ -214,6 +193,7 @@ public class UserInfo {
|
||||||
/**
|
/**
|
||||||
* @return the zoneinfo
|
* @return the zoneinfo
|
||||||
*/
|
*/
|
||||||
|
@Basic
|
||||||
public String getZoneinfo() {
|
public String getZoneinfo() {
|
||||||
return zoneinfo;
|
return zoneinfo;
|
||||||
}
|
}
|
||||||
|
@ -226,6 +206,7 @@ public class UserInfo {
|
||||||
/**
|
/**
|
||||||
* @return the locale
|
* @return the locale
|
||||||
*/
|
*/
|
||||||
|
@Basic
|
||||||
public String getLocale() {
|
public String getLocale() {
|
||||||
return locale;
|
return locale;
|
||||||
}
|
}
|
||||||
|
@ -236,20 +217,22 @@ public class UserInfo {
|
||||||
this.locale = locale;
|
this.locale = locale;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @return the phone_number
|
* @return the phoneNumber
|
||||||
*/
|
*/
|
||||||
public String getPhone_number() {
|
@Basic
|
||||||
return phone_number;
|
public String getPhoneNumber() {
|
||||||
|
return phoneNumber;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param phone_number the phone_number to set
|
* @param phoneNumber the phoneNumber to set
|
||||||
*/
|
*/
|
||||||
public void setPhone_number(String phone_number) {
|
public void setPhoneNumber(String phoneNumber) {
|
||||||
this.phone_number = phone_number;
|
this.phoneNumber = phoneNumber;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @return the address
|
* @return the address
|
||||||
*/
|
*/
|
||||||
|
@OneToOne
|
||||||
public Address getAddress() {
|
public Address getAddress() {
|
||||||
return address;
|
return address;
|
||||||
}
|
}
|
||||||
|
@ -260,16 +243,17 @@ public class UserInfo {
|
||||||
this.address = address;
|
this.address = address;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @return the updated_time
|
* @return the updatedTime
|
||||||
*/
|
*/
|
||||||
public String getUpdated_time() {
|
@Basic
|
||||||
return updated_time;
|
public String getUpdatedTime() {
|
||||||
|
return updatedTime;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param updated_time the updated_time to set
|
* @param updatedTime the updatedTime to set
|
||||||
*/
|
*/
|
||||||
public void setUpdated_time(String updated_time) {
|
public void setUpdatedTime(String updatedTime) {
|
||||||
this.updated_time = updated_time;
|
this.updatedTime = updatedTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,20 @@
|
||||||
package org.mitre.openid.connect.model;
|
package org.mitre.openid.connect.model;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.persistence.ElementCollection;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.FetchType;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.GenerationType;
|
import javax.persistence.GenerationType;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.JoinColumn;
|
import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
import javax.persistence.OneToMany;
|
import javax.persistence.NamedQueries;
|
||||||
|
import javax.persistence.NamedQuery;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import org.springframework.security.oauth2.provider.ClientDetails;
|
import org.mitre.oauth2.model.ClientDetailsEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicator that login to a site should be automatically granted
|
* Indicator that login to a site should be automatically granted
|
||||||
|
@ -21,27 +24,23 @@ import org.springframework.security.oauth2.provider.ClientDetails;
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="whitelistedsite")
|
@Table(name="whitelistedsite")
|
||||||
|
@NamedQueries({
|
||||||
|
@NamedQuery(name = "WhitelistedSite.getAll", query = "select w from WhitelistedSite w")
|
||||||
|
})
|
||||||
public class WhitelistedSite {
|
public class WhitelistedSite {
|
||||||
|
|
||||||
// unique id
|
// unique id
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
// who added this site to the whitelist (should be an admin)
|
// who added this site to the whitelist (should be an admin)
|
||||||
@ManyToOne
|
|
||||||
@JoinColumn(name="userinfo_id")
|
|
||||||
private UserInfo userInfo;
|
private UserInfo userInfo;
|
||||||
|
|
||||||
// which OAuth2 client is this tied to
|
// which OAuth2 client is this tied to
|
||||||
@ManyToOne
|
private ClientDetailsEntity clientDetails;
|
||||||
@JoinColumn(name="clientdetails_id")
|
|
||||||
private ClientDetails clientDetails;
|
|
||||||
|
|
||||||
// what scopes be allowed by default
|
// what scopes be allowed by default
|
||||||
// this should include all information for what data to access
|
// this should include all information for what data to access
|
||||||
@OneToMany(mappedBy="whitelistedsite")
|
private Set<String> allowedScopes;
|
||||||
private Collection<String> allowedScopes;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Empty constructor
|
* Empty constructor
|
||||||
|
@ -53,6 +52,8 @@ public class WhitelistedSite {
|
||||||
/**
|
/**
|
||||||
* @return the id
|
* @return the id
|
||||||
*/
|
*/
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -67,6 +68,8 @@ public class WhitelistedSite {
|
||||||
/**
|
/**
|
||||||
* @return the userInfo
|
* @return the userInfo
|
||||||
*/
|
*/
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name="userinfo_id")
|
||||||
public UserInfo getUserInfo() {
|
public UserInfo getUserInfo() {
|
||||||
return userInfo;
|
return userInfo;
|
||||||
}
|
}
|
||||||
|
@ -81,28 +84,31 @@ public class WhitelistedSite {
|
||||||
/**
|
/**
|
||||||
* @return the clientDetails
|
* @return the clientDetails
|
||||||
*/
|
*/
|
||||||
public ClientDetails getClientDetails() {
|
@ManyToOne
|
||||||
|
@JoinColumn(name="clientdetails_id")
|
||||||
|
public ClientDetailsEntity getClientDetails() {
|
||||||
return clientDetails;
|
return clientDetails;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param clientDetails the clientDetails to set
|
* @param clientDetails the clientDetails to set
|
||||||
*/
|
*/
|
||||||
public void setClientDetails(ClientDetails clientDetails) {
|
public void setClientDetails(ClientDetailsEntity clientDetails) {
|
||||||
this.clientDetails = clientDetails;
|
this.clientDetails = clientDetails;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the allowedScopes
|
* @return the allowedScopes
|
||||||
*/
|
*/
|
||||||
public Collection<String> getAllowedScopes() {
|
@ElementCollection(fetch = FetchType.EAGER)
|
||||||
|
public Set<String> getAllowedScopes() {
|
||||||
return allowedScopes;
|
return allowedScopes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param allowedScopes the allowedScopes to set
|
* @param allowedScopes the allowedScopes to set
|
||||||
*/
|
*/
|
||||||
public void setAllowedScopes(Collection<String> allowedScopes) {
|
public void setAllowedScopes(Set<String> allowedScopes) {
|
||||||
this.allowedScopes = allowedScopes;
|
this.allowedScopes = allowedScopes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue