diff --git a/src/main/java/org/mitre/openid/connect/model/ApprovedSite.java b/src/main/java/org/mitre/openid/connect/model/ApprovedSite.java new file mode 100644 index 000000000..3f16c4d03 --- /dev/null +++ b/src/main/java/org/mitre/openid/connect/model/ApprovedSite.java @@ -0,0 +1,155 @@ +package org.mitre.openid.connect.model; + +import java.util.Collection; +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; + +import org.springframework.security.oauth2.provider.ClientDetails; + +@Entity +public class ApprovedSite { + + // unique id + private Long id; + + // which user made the approval + private UserInfo userInfo; + + // which OAuth2 client is this tied to + private ClientDetails clientDetails; + + // when was this first approved? + private Date creationDate; + + // when was this last accessed? + private Date accessDate; + + // if this is a time-limited access, when does it run out? + private Date timeoutDate; + + // what scopes have been allowed + // this should include all information for what data to access + private Collection allowedScopes; + + // TODO: should we store the OAuth2 tokens and IdTokens here? + + + public ApprovedSite() { + + } + + /** + * @return the id + */ + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + public Long getId() { + return id; + } + + /** + * @param id the id to set + */ + public void setId(Long id) { + this.id = id; + } + + /** + * @return the userInfo + */ + public UserInfo getUserInfo() { + return userInfo; + } + + /** + * @param userInfo the userInfo to set + */ + public void setUserInfo(UserInfo userInfo) { + this.userInfo = userInfo; + } + + /** + * @return the clientDetails + */ + public ClientDetails getClientDetails() { + return clientDetails; + } + + /** + * @param clientDetails the clientDetails to set + */ + public void setClientDetails(ClientDetails clientDetails) { + this.clientDetails = clientDetails; + } + + /** + * @return the creationDate + */ + @Basic + @Temporal(javax.persistence.TemporalType.TIMESTAMP) + public Date getCreationDate() { + return creationDate; + } + + /** + * @param creationDate the creationDate to set + */ + public void setCreationDate(Date creationDate) { + this.creationDate = creationDate; + } + + /** + * @return the accessDate + */ + @Basic + @Temporal(javax.persistence.TemporalType.TIMESTAMP) + public Date getAccessDate() { + return accessDate; + } + + /** + * @param accessDate the accessDate to set + */ + public void setAccessDate(Date accessDate) { + this.accessDate = accessDate; + } + + /** + * @return the allowedScopes + */ + public Collection getAllowedScopes() { + return allowedScopes; + } + + /** + * @param allowedScopes the allowedScopes to set + */ + public void setAllowedScopes(Collection allowedScopes) { + this.allowedScopes = allowedScopes; + } + + /** + * @return the timeoutDate + */ + @Basic + @Temporal(javax.persistence.TemporalType.TIMESTAMP) + public Date getTimeoutDate() { + return timeoutDate; + } + + /** + * @param timeoutDate the timeoutDate to set + */ + public void setTimeoutDate(Date timeoutDate) { + this.timeoutDate = timeoutDate; + } + + + +} diff --git a/src/main/java/org/mitre/openid/connect/model/Event.java b/src/main/java/org/mitre/openid/connect/model/Event.java new file mode 100644 index 000000000..d287ad996 --- /dev/null +++ b/src/main/java/org/mitre/openid/connect/model/Event.java @@ -0,0 +1,23 @@ +package org.mitre.openid.connect.model; + +import java.util.Date; + +import javax.persistence.Entity; + +/** + * Class to contain a logged event in the system. + * + * @author jricher + * + */ + +@Entity +public class Event { + + public static enum EventType { LOGIN, AUTHORIZATION, ACCESS } + + private Long id; + private EventType type; + private Date timestamp; + +} diff --git a/src/main/java/org/mitre/openid/connect/model/WhitelistedSite.java b/src/main/java/org/mitre/openid/connect/model/WhitelistedSite.java new file mode 100644 index 000000000..ca5b4987d --- /dev/null +++ b/src/main/java/org/mitre/openid/connect/model/WhitelistedSite.java @@ -0,0 +1,34 @@ +package org.mitre.openid.connect.model; + +import java.util.Collection; +import java.util.Date; + +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; + +import org.springframework.security.oauth2.provider.ClientDetails; + +/** + * Indicator that login to a site should be automatically granted + * without user interaction. + * @author jricher + * + */ +public class WhitelistedSite { + + // unique id + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Long id; + + // who added this site to the whitelist (should be an admin) + private UserInfo userInfo; + + // which OAuth2 client is this tied to + private ClientDetails clientDetails; + + // what scopes be allowed by default + // this should include all information for what data to access + private Collection allowedScopes; +} diff --git a/src/main/java/org/mitre/openid/connect/repository/ApprovedSiteRepository.java b/src/main/java/org/mitre/openid/connect/repository/ApprovedSiteRepository.java new file mode 100644 index 000000000..db7b06574 --- /dev/null +++ b/src/main/java/org/mitre/openid/connect/repository/ApprovedSiteRepository.java @@ -0,0 +1,11 @@ +package org.mitre.openid.connect.repository; + +import org.mitre.openid.connect.model.ApprovedSite; + +public interface ApprovedSiteRepository { + + public ApprovedSite getById(Long id); + + public ApprovedSite getByUrl(String url); + +} diff --git a/src/main/java/org/mitre/openid/connect/repository/IdTokenRepository.java b/src/main/java/org/mitre/openid/connect/repository/IdTokenRepository.java new file mode 100644 index 000000000..5e9183093 --- /dev/null +++ b/src/main/java/org/mitre/openid/connect/repository/IdTokenRepository.java @@ -0,0 +1,5 @@ +package org.mitre.openid.connect.repository; + +public interface IdTokenRepository { + +} diff --git a/src/main/java/org/mitre/openid/connect/repository/UserInfoRepository.java b/src/main/java/org/mitre/openid/connect/repository/UserInfoRepository.java new file mode 100644 index 000000000..9da679568 --- /dev/null +++ b/src/main/java/org/mitre/openid/connect/repository/UserInfoRepository.java @@ -0,0 +1,9 @@ +package org.mitre.openid.connect.repository; + +import org.mitre.openid.connect.model.UserInfo; + +public interface UserInfoRepository { + + public UserInfo getByUserId(String user_id); + +} diff --git a/src/main/java/org/mitre/openid/connect/repository/WhitelistedSiteRepository.java b/src/main/java/org/mitre/openid/connect/repository/WhitelistedSiteRepository.java new file mode 100644 index 000000000..a2478efce --- /dev/null +++ b/src/main/java/org/mitre/openid/connect/repository/WhitelistedSiteRepository.java @@ -0,0 +1,5 @@ +package org.mitre.openid.connect.repository; + +public interface WhitelistedSiteRepository { + +}