diff --git a/.project b/.project index 041d25bcb..411785c3b 100644 --- a/.project +++ b/.project @@ -5,11 +5,6 @@ - - org.maven.ide.eclipse.maven2Builder - - - org.eclipse.m2e.core.maven2Builder @@ -18,6 +13,5 @@ org.eclipse.m2e.core.maven2Nature - org.maven.ide.eclipse.maven2Nature diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 000000000..720550596 --- /dev/null +++ b/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,5 @@ +#Wed Jan 25 10:37:18 EST 2012 +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/.settings/org.maven.ide.eclipse.prefs b/.settings/org.maven.ide.eclipse.prefs index 46d0bb234..88b78268f 100644 --- a/.settings/org.maven.ide.eclipse.prefs +++ b/.settings/org.maven.ide.eclipse.prefs @@ -1,4 +1,4 @@ -#Wed Jan 04 13:38:09 EST 2012 +#Wed Jan 25 10:37:18 EST 2012 activeProfiles= eclipse.preferences.version=1 fullBuildGoals=process-test-resources diff --git a/server/.classpath b/server/.classpath index 59b77ad1e..8ca8f4c92 100644 --- a/server/.classpath +++ b/server/.classpath @@ -10,10 +10,5 @@ - - - - - diff --git a/server/.project b/server/.project index 9debe6479..4c7c87524 100644 --- a/server/.project +++ b/server/.project @@ -26,11 +26,6 @@ - - org.maven.ide.eclipse.maven2Builder - - - org.eclipse.m2e.core.maven2Builder @@ -38,12 +33,11 @@ - org.eclipse.m2e.core.maven2Nature - org.maven.ide.eclipse.maven2Nature org.eclipse.jem.workbench.JavaEMFNature org.eclipse.wst.common.modulecore.ModuleCoreNature org.eclipse.jdt.core.javanature org.eclipse.wst.common.project.facet.core.nature org.eclipse.wst.jsdt.core.jsNature + org.eclipse.m2e.core.maven2Nature diff --git a/server/.settings/com.springsource.sts.maven.prefs b/server/.settings/com.springsource.sts.maven.prefs index ca1b6dc30..02bf64d50 100644 --- a/server/.settings/com.springsource.sts.maven.prefs +++ b/server/.settings/com.springsource.sts.maven.prefs @@ -1,3 +1,3 @@ -#Wed Jan 04 13:45:00 EST 2012 +#Wed Jan 25 10:37:18 EST 2012 com.springsource.sts.maven.maven.automatically.update=true eclipse.preferences.version=1 diff --git a/server/.settings/org.eclipse.m2e.core.prefs b/server/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 000000000..720550596 --- /dev/null +++ b/server/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,5 @@ +#Wed Jan 25 10:37:18 EST 2012 +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/server/.settings/org.eclipse.wst.common.component b/server/.settings/org.eclipse.wst.common.component index 7297c8ed1..9ccb357b3 100644 --- a/server/.settings/org.eclipse.wst.common.component +++ b/server/.settings/org.eclipse.wst.common.component @@ -3,8 +3,8 @@ - + uses diff --git a/server/src/main/java/org/mitre/openid/connect/repository/ApprovedSiteRepository.java b/server/src/main/java/org/mitre/openid/connect/repository/ApprovedSiteRepository.java index 61a25405b..4c6646eac 100644 --- a/server/src/main/java/org/mitre/openid/connect/repository/ApprovedSiteRepository.java +++ b/server/src/main/java/org/mitre/openid/connect/repository/ApprovedSiteRepository.java @@ -31,7 +31,7 @@ public interface ApprovedSiteRepository { public Collection getAll(); /** - * Return a collection of UserInfo managed by this repository matching the + * Return a collection of ApprovedSite managed by this repository matching the * provided ClientDetailsEntity * * @param userId @@ -41,7 +41,7 @@ public interface ApprovedSiteRepository { ClientDetailsEntity clientDetails); /** - * Return a collection of UserInfo managed by this repository matching the + * Return a collection of ApprovedSite managed by this repository matching the * provided UserInfo * * @param userId diff --git a/server/src/main/java/org/mitre/openid/connect/repository/UserInfoRepository.java b/server/src/main/java/org/mitre/openid/connect/repository/UserInfoRepository.java index 05ebe1e89..ca441f131 100644 --- a/server/src/main/java/org/mitre/openid/connect/repository/UserInfoRepository.java +++ b/server/src/main/java/org/mitre/openid/connect/repository/UserInfoRepository.java @@ -12,6 +12,15 @@ import org.mitre.openid.connect.model.UserInfo; */ public interface UserInfoRepository { + /** + * Returns the UserInfo for the given user id + * + * @param userId + * userId the user id of the UserInfo + * @return a valid UserInfo if it exists, null otherwise + */ + public UserInfo getByUserId(String userId); + /** * Persists a UserInfo * @@ -28,6 +37,14 @@ public interface UserInfoRepository { */ public void remove(UserInfo userInfo); + /** + * Removes the UserInfo from the repository for the given user id + * + * @param userId + * the user id for the UserInfo object to remove + */ + public void removeByUserId(String userId); + /** * Return a collection of all UserInfos managed by this repository * diff --git a/server/src/main/java/org/mitre/openid/connect/repository/impl/JpaIdTokenClaimsRepository.java b/server/src/main/java/org/mitre/openid/connect/repository/impl/JpaIdTokenClaimsRepository.java index d13cae2d2..6a1f184e7 100644 --- a/server/src/main/java/org/mitre/openid/connect/repository/impl/JpaIdTokenClaimsRepository.java +++ b/server/src/main/java/org/mitre/openid/connect/repository/impl/JpaIdTokenClaimsRepository.java @@ -9,6 +9,12 @@ import org.mitre.openid.connect.model.IdTokenClaims; import org.mitre.openid.connect.repository.IdTokenClaimsRepository; import org.springframework.transaction.annotation.Transactional; +/** + * JPA IdTokenClaims repository implementation + * + * @author Michael Joseph Walsh + * + */ public class JpaIdTokenClaimsRepository implements IdTokenClaimsRepository { @PersistenceContext diff --git a/server/src/main/java/org/mitre/openid/connect/repository/impl/JpaIdTokenRepository.java b/server/src/main/java/org/mitre/openid/connect/repository/impl/JpaIdTokenRepository.java index 2cd88f6a1..53fbceb05 100644 --- a/server/src/main/java/org/mitre/openid/connect/repository/impl/JpaIdTokenRepository.java +++ b/server/src/main/java/org/mitre/openid/connect/repository/impl/JpaIdTokenRepository.java @@ -9,6 +9,12 @@ import org.mitre.openid.connect.model.IdToken; import org.mitre.openid.connect.repository.IdTokenRepository; import org.springframework.transaction.annotation.Transactional; +/** + * JPA IdToken repository implementation + * + * @author Michael Joseph Walsh + * + */ public class JpaIdTokenRepository implements IdTokenRepository { @PersistenceContext diff --git a/server/src/main/java/org/mitre/openid/connect/repository/impl/JpaUserInfoRepository.java b/server/src/main/java/org/mitre/openid/connect/repository/impl/JpaUserInfoRepository.java index 6a55274a1..a56364887 100644 --- a/server/src/main/java/org/mitre/openid/connect/repository/impl/JpaUserInfoRepository.java +++ b/server/src/main/java/org/mitre/openid/connect/repository/impl/JpaUserInfoRepository.java @@ -14,7 +14,7 @@ import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; /** - * * JPA UserInfo repository implementation + * JPA UserInfo repository implementation * * @author Michael Joseph Walsh * @@ -24,7 +24,13 @@ public class JpaUserInfoRepository implements UserInfoRepository { @PersistenceContext private EntityManager manager; - + + @Override + @Transactional + public UserInfo getByUserId(String userId) { + return manager.find(UserInfo.class, userId); + } + @Override @Transactional public UserInfo save(UserInfo userInfo) { @@ -44,6 +50,18 @@ public class JpaUserInfoRepository implements UserInfoRepository { } } + @Override + @Transactional + public void removeByUserId(String userId) { + UserInfo found = manager.find(UserInfo.class, userId); + + if (found != null) { + manager.remove(found); + } else { + throw new IllegalArgumentException(); + } + } + @Override @Transactional public Collection getAll() { @@ -53,4 +71,5 @@ public class JpaUserInfoRepository implements UserInfoRepository { return query.getResultList(); } + } diff --git a/server/src/main/java/org/mitre/openid/connect/repository/impl/JpaWhitelistedSiteRepository.java b/server/src/main/java/org/mitre/openid/connect/repository/impl/JpaWhitelistedSiteRepository.java new file mode 100644 index 000000000..67808e124 --- /dev/null +++ b/server/src/main/java/org/mitre/openid/connect/repository/impl/JpaWhitelistedSiteRepository.java @@ -0,0 +1,60 @@ +package org.mitre.openid.connect.repository.impl; + +import static org.mitre.util.jpa.JpaUtil.saveOrUpdate; + +import java.util.Collection; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.TypedQuery; + +import org.mitre.openid.connect.model.WhitelistedSite; +import org.mitre.openid.connect.repository.WhitelistedSiteRepository; +import org.springframework.transaction.annotation.Transactional; + +public class JpaWhitelistedSiteRepository implements WhitelistedSiteRepository { + + @PersistenceContext + private EntityManager manager; + + @Override + @Transactional + public Collection getAll() { + TypedQuery query = manager.createNamedQuery( + "WhitelistedSite.getAll", WhitelistedSite.class); + return query.getResultList(); + } + + @Override + @Transactional + public WhitelistedSite getById(Long id) { + return manager.find(WhitelistedSite.class, id); + } + + @Override + @Transactional + public void remove(WhitelistedSite whitelistedSite) { + WhitelistedSite found = manager.find(WhitelistedSite.class, + whitelistedSite.getId()); + + if (found != null) { + manager.remove(whitelistedSite); + } else { + throw new IllegalArgumentException(); + } + } + + @Override + @Transactional + public void removeById(Long id) { + WhitelistedSite found = getById(id); + + manager.remove(found); + } + + @Override + @Transactional + public WhitelistedSite save(WhitelistedSite whiteListedSite) { + return saveOrUpdate(whiteListedSite.getId(), manager, whiteListedSite); + } +} diff --git a/server/src/main/java/org/mitre/openid/connect/service/AddressService.java b/server/src/main/java/org/mitre/openid/connect/service/AddressService.java new file mode 100644 index 000000000..b4f9f67cc --- /dev/null +++ b/server/src/main/java/org/mitre/openid/connect/service/AddressService.java @@ -0,0 +1,45 @@ +package org.mitre.openid.connect.service; + +import org.mitre.openid.connect.model.Address; + +/** + * Interface for Address service + * + * @author Michael Joseph Walsh + * + */ +public interface AddressService { + + /** + * Save an Address + * + * @param address + * the Address to be saved + */ + public void save(Address address); + + /** + * Get Address for id + * + * @param id + * id for Address + * @return Address for id, or null + */ + public Address getById(Long id); + + /** + * Remove the Address + * + * @param address + * the Address to remove + */ + public void remove(Address address); + + /** + * Remove the Address + * + * @param id + * id for Address to remove + */ + public void removeById(Long id); +} diff --git a/server/src/main/java/org/mitre/openid/connect/service/ApprovedSiteService.java b/server/src/main/java/org/mitre/openid/connect/service/ApprovedSiteService.java new file mode 100644 index 000000000..8ddecbd0d --- /dev/null +++ b/server/src/main/java/org/mitre/openid/connect/service/ApprovedSiteService.java @@ -0,0 +1,76 @@ +package org.mitre.openid.connect.service; + +import java.util.Collection; + +import org.mitre.oauth2.model.ClientDetailsEntity; +import org.mitre.openid.connect.model.ApprovedSite; +import org.mitre.openid.connect.model.UserInfo; + +/** + * Interface for ApprovedSite service + * + * @author Michael Joseph Walsh + * + */ +public interface ApprovedSiteService { + + + /** + * Return a collection of all ApprovedSites + * + * @return the ApprovedSite collection, or null + */ + public Collection getAll(); + + /** + * Return a collection of ApprovedSite managed by this repository matching the + * provided ClientDetailsEntity + * + * @param userId + * @return + */ + public Collection getByClientDetails(ClientDetailsEntity clientDetails); + + /** + * Return a collection of ApprovedSite managed by this repository matching the + * provided UserInfo + * + * @param userId + * @return + */ + public Collection getByUserInfo(UserInfo userInfo); + + /** + * Save an ApprovedSite + * + * @param approvedSite + * the ApprovedSite to be saved + */ + public void save(ApprovedSite approvedSite); + + /** + * Get ApprovedSite for id + * + * @param id + * id for ApprovedSite + * @return ApprovedSite for id, or null + */ + public ApprovedSite getById(Long id); + + /** + * Remove the ApprovedSite + * + * @param approvedSite + * the ApprovedSite to remove + */ + public void remove(ApprovedSite approvedSite); + + /** + * Remove the ApprovedSite + * + * @param id + * id for ApprovedSite to remove + */ + public void removeById(Long id); + +} diff --git a/server/src/main/java/org/mitre/openid/connect/service/EventService.java b/server/src/main/java/org/mitre/openid/connect/service/EventService.java new file mode 100644 index 000000000..5fac950bb --- /dev/null +++ b/server/src/main/java/org/mitre/openid/connect/service/EventService.java @@ -0,0 +1,45 @@ +package org.mitre.openid.connect.service; + +import org.mitre.openid.connect.model.Event; + +/** + * Interface for Event service + * + * @author Michael Joseph Walsh + * + */ +public interface EventService { + + /** + * Save Event + * + * @param event + * Event to be saved + */ + public void save(Event event); + + /** + * Get Event by id + * + * @param id + * id for Event + * @return Event for id, or null + */ + public Event getById(Long id); + + /** + * Remove Event + * + * @param event + * Event to remove + */ + public void remove(Event event); + + /** + * Remove Event for id + * + * @param id + * id for Event to remove + */ + public void removeById(Long id); +} diff --git a/server/src/main/java/org/mitre/openid/connect/service/IdTokenClaimsService.java b/server/src/main/java/org/mitre/openid/connect/service/IdTokenClaimsService.java new file mode 100644 index 000000000..e968ad00a --- /dev/null +++ b/server/src/main/java/org/mitre/openid/connect/service/IdTokenClaimsService.java @@ -0,0 +1,45 @@ +package org.mitre.openid.connect.service; + +import org.mitre.openid.connect.model.IdTokenClaims; + +/** + * Interface for IdTokenClaims service + * + * @author Michael Joseph Walsh + * + */ +public interface IdTokenClaimsService { + + /** + * Save an IdTokenClaims + * + * @param address + * the Address to be saved + */ + public void save(IdTokenClaims idTokenClaims); + + /** + * Get IdTokenClaims for id + * + * @param id + * id for IdTokenClaims + * @return IdTokenClaims for id, or null + */ + public IdTokenClaims getById(Long id); + + /** + * Remove the IdTokenClaims + * + * @param idTokenClaims + * the IdTokenClaims to remove + */ + public void remove(IdTokenClaims idTokenClaims); + + /** + * Remove the IdTokenClaims + * + * @param id + * id for IdTokenClaims to remove + */ + public void removeById(Long id); +} diff --git a/server/src/main/java/org/mitre/openid/connect/service/IdTokenService.java b/server/src/main/java/org/mitre/openid/connect/service/IdTokenService.java new file mode 100644 index 000000000..b0ea7e688 --- /dev/null +++ b/server/src/main/java/org/mitre/openid/connect/service/IdTokenService.java @@ -0,0 +1,45 @@ +package org.mitre.openid.connect.service; + +import org.mitre.openid.connect.model.IdToken; + +/** + * Interface for IdToken service + * + * @author Michael Joseph Walsh + * + */ +public interface IdTokenService { + + /** + * Save an IdToken + * + * @param idToken + * the IdToken to be saved + */ + public void save(IdToken idToken); + + /** + * Get IdToken for id + * + * @param id + * id for IdToken + * @return IdToken for id, or null + */ + public IdToken getById(Long id); + + /** + * Remove the IdToken + * + * @param idToken + * the IdToken to remove + */ + public void remove(IdToken idToken); + + /** + * Remove the IdToken + * + * @param id + * id for IdToken to remove + */ + public void removeById(Long id); +} diff --git a/server/src/main/java/org/mitre/openid/connect/service/UserInfoService.java b/server/src/main/java/org/mitre/openid/connect/service/UserInfoService.java new file mode 100644 index 000000000..205e343c4 --- /dev/null +++ b/server/src/main/java/org/mitre/openid/connect/service/UserInfoService.java @@ -0,0 +1,45 @@ +package org.mitre.openid.connect.service; + +import org.mitre.openid.connect.model.UserInfo; + +/** + * Interface for UserInfo service + * + * @author Michael Joseph Walsh + * + */ +public interface UserInfoService { + + /** + * Save an UserInfo + * + * @param userInfo + * the UserInfo to be saved + */ + public void save(UserInfo userInfo); + + /** + * Get UserInfo for user id + * + * @param userId + * user id for UserInfo + * @return UserInfo for user id, or null + */ + public UserInfo getByUserId(String userId); + + /** + * Remove the UserInfo + * + * @param userInfo + * the UserInfo to remove + */ + public void remove(UserInfo userInfo); + + /** + * Remove the UserInfo + * + * @param userId + * user id for UserInfo to remove + */ + public void removeByUserId(String userId); +} diff --git a/server/src/main/java/org/mitre/openid/connect/service/WhitelistedSiteService.java b/server/src/main/java/org/mitre/openid/connect/service/WhitelistedSiteService.java new file mode 100644 index 000000000..5643db7b5 --- /dev/null +++ b/server/src/main/java/org/mitre/openid/connect/service/WhitelistedSiteService.java @@ -0,0 +1,46 @@ +package org.mitre.openid.connect.service; + +import org.mitre.openid.connect.model.WhitelistedSite; + +/** + * Interface for WhitelistedSite service + * + * @author Michael Joseph Walsh + * + */ +public interface WhitelistedSiteService { + + /** + * Returns the WhitelistedSite for the given id + * + * @param id + * id the id of the WhitelistedSite + * @return a valid WhitelistedSite if it exists, null otherwise + */ + public WhitelistedSite getById(Long id); + + /** + * Removes the given WhitelistedSite from the repository + * + * @param address + * the WhitelistedSite object to remove + */ + public void remove(WhitelistedSite whitelistedSite); + + /** + * Removes an WhitelistedSite from the repository + * + * @param id + * the id of the WhitelistedSite to remove + */ + public void removeById(Long id); + + /** + * Persists a WhitelistedSite + * + * @param whitelistedSite + * the WhitelistedSite to be saved + * @return + */ + public WhitelistedSite save(WhitelistedSite whitelistedSite); +} diff --git a/server/src/main/java/org/mitre/openid/connect/service/empty.txt b/server/src/main/java/org/mitre/openid/connect/service/empty.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/server/src/main/java/org/mitre/openid/connect/service/impl/AddressServiceImpl.java b/server/src/main/java/org/mitre/openid/connect/service/impl/AddressServiceImpl.java new file mode 100644 index 000000000..05c06d601 --- /dev/null +++ b/server/src/main/java/org/mitre/openid/connect/service/impl/AddressServiceImpl.java @@ -0,0 +1,58 @@ +package org.mitre.openid.connect.service.impl; + +import org.mitre.openid.connect.model.Address; +import org.mitre.openid.connect.repository.impl.JpaAddressRepository; +import org.mitre.openid.connect.service.AddressService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * Implementation of the AddressService + * + * @author Michael Joseph Walsh + * + */ +@Service +@Transactional +public class AddressServiceImpl implements AddressService { + + @Autowired + private JpaAddressRepository addressRepository; + + /** + * Default constructor + */ + public AddressServiceImpl() { + + } + + /** + * Constructor for use in test harnesses. + * + * @param repository + */ + public AddressServiceImpl(JpaAddressRepository addressRepository) { + this.addressRepository = addressRepository; + } + + @Override + public void save(Address address) { + this.addressRepository.save(address); + } + + @Override + public Address getById(Long id) { + return addressRepository.getById(id); + } + + @Override + public void remove(Address address) { + this.addressRepository.remove(address); + } + + @Override + public void removeById(Long id) { + this.addressRepository.removeById(id); + } +} diff --git a/server/src/main/java/org/mitre/openid/connect/service/impl/ApprovedSiteServiceImpl.java b/server/src/main/java/org/mitre/openid/connect/service/impl/ApprovedSiteServiceImpl.java new file mode 100644 index 000000000..a9bca40ac --- /dev/null +++ b/server/src/main/java/org/mitre/openid/connect/service/impl/ApprovedSiteServiceImpl.java @@ -0,0 +1,79 @@ +package org.mitre.openid.connect.service.impl; + +import java.util.Collection; + +import org.mitre.oauth2.model.ClientDetailsEntity; +import org.mitre.openid.connect.model.ApprovedSite; +import org.mitre.openid.connect.model.UserInfo; +import org.mitre.openid.connect.repository.impl.JpaApprovedSiteRepository; +import org.mitre.openid.connect.service.ApprovedSiteService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * Implementation of the ApprovedSiteService + * + * @author Michael Joseph Walsh + * + */ +@Service +@Transactional +public class ApprovedSiteServiceImpl implements ApprovedSiteService { + + @Autowired + private JpaApprovedSiteRepository approvedSiteRepository; + + /** + * Default constructor + */ + public ApprovedSiteServiceImpl() { + + } + + /** + * Constructor for use in test harnesses. + * + * @param repository + */ + public ApprovedSiteServiceImpl(JpaApprovedSiteRepository approvedSiteRepository) { + this.approvedSiteRepository = approvedSiteRepository; + } + + @Override + public Collection getAll() { + return approvedSiteRepository.getAll(); + } + + @Override + public Collection getByClientDetails( + ClientDetailsEntity clientDetails) { + return approvedSiteRepository.getByClientDetails(clientDetails); + } + + @Override + public Collection getByUserInfo(UserInfo userInfo) { + return approvedSiteRepository.getByUserInfo(userInfo); + } + + @Override + public void save(ApprovedSite approvedSite) { + approvedSiteRepository.save(approvedSite); + } + + @Override + public ApprovedSite getById(Long id) { + return approvedSiteRepository.getById(id); + } + + @Override + public void remove(ApprovedSite approvedSite) { + approvedSiteRepository.remove(approvedSite); + } + + @Override + public void removeById(Long id) { + approvedSiteRepository.removeById(id); + } + +} diff --git a/server/src/main/java/org/mitre/openid/connect/service/impl/EventServiceImpl.java b/server/src/main/java/org/mitre/openid/connect/service/impl/EventServiceImpl.java new file mode 100644 index 000000000..eb40caa00 --- /dev/null +++ b/server/src/main/java/org/mitre/openid/connect/service/impl/EventServiceImpl.java @@ -0,0 +1,59 @@ +package org.mitre.openid.connect.service.impl; + +import org.mitre.openid.connect.model.Event; +import org.mitre.openid.connect.repository.impl.JpaEventRepository; +import org.mitre.openid.connect.service.EventService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * Implementation of the EventService + * + * @author Michael Joseph Walsh + * + */ +@Service +@Transactional +public class EventServiceImpl implements EventService { + + @Autowired + private JpaEventRepository eventRepository; + + /** + * Default constructor + */ + public EventServiceImpl() { + + } + + /** + * Constructor for use in test harnesses. + * + * @param repository + */ + public EventServiceImpl(JpaEventRepository eventRepository) { + this.eventRepository = eventRepository; + } + + @Override + public void save(Event event) { + eventRepository.save(event); + } + + @Override + public Event getById(Long id) { + return eventRepository.getById(id); + } + + @Override + public void remove(Event event) { + eventRepository.remove(event); + } + + @Override + public void removeById(Long id) { + eventRepository.removeById(id); + } + +} diff --git a/server/src/main/java/org/mitre/openid/connect/service/impl/IdTokenClaimsServiceImpl.java b/server/src/main/java/org/mitre/openid/connect/service/impl/IdTokenClaimsServiceImpl.java new file mode 100644 index 000000000..cc1e36c33 --- /dev/null +++ b/server/src/main/java/org/mitre/openid/connect/service/impl/IdTokenClaimsServiceImpl.java @@ -0,0 +1,59 @@ +package org.mitre.openid.connect.service.impl; + +import org.mitre.openid.connect.model.IdTokenClaims; +import org.mitre.openid.connect.repository.impl.JpaIdTokenClaimsRepository; +import org.mitre.openid.connect.service.IdTokenClaimsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * Implementation of the IdTokenClaimsService + * + * @author Michael Joseph Walsh + * + */ +@Service +@Transactional +public class IdTokenClaimsServiceImpl implements IdTokenClaimsService { + + @Autowired + private JpaIdTokenClaimsRepository idTokenClaimsRepository; + + /** + * Default constructor + */ + public IdTokenClaimsServiceImpl() { + + } + + /** + * Constructor for use in test harnesses. + * + * @param repository + */ + public IdTokenClaimsServiceImpl(JpaIdTokenClaimsRepository idTokenClaimsRepository) { + this.idTokenClaimsRepository = idTokenClaimsRepository; + } + + @Override + public void save(IdTokenClaims idTokenClaims) { + idTokenClaimsRepository.save(idTokenClaims); + } + + @Override + public IdTokenClaims getById(Long id) { + return idTokenClaimsRepository.getById(id); + } + + @Override + public void remove(IdTokenClaims idTokenClaims) { + idTokenClaimsRepository.remove(idTokenClaims); + } + + @Override + public void removeById(Long id) { + idTokenClaimsRepository.removeById(id); + } + +} diff --git a/server/src/main/java/org/mitre/openid/connect/service/impl/IdTokenServiceImpl.java b/server/src/main/java/org/mitre/openid/connect/service/impl/IdTokenServiceImpl.java new file mode 100644 index 000000000..d92c4a963 --- /dev/null +++ b/server/src/main/java/org/mitre/openid/connect/service/impl/IdTokenServiceImpl.java @@ -0,0 +1,59 @@ +package org.mitre.openid.connect.service.impl; + +import org.mitre.openid.connect.model.IdToken; +import org.mitre.openid.connect.repository.impl.JpaIdTokenRepository; +import org.mitre.openid.connect.service.IdTokenService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * Implementation of the IdTokenService + * + * @author Michael Joseph Walsh + * + */ +@Service +@Transactional +public class IdTokenServiceImpl implements IdTokenService { + + @Autowired + private JpaIdTokenRepository idTokenRepository; + + /** + * Default constructor + */ + public IdTokenServiceImpl() { + + } + + /** + * Constructor for use in test harnesses. + * + * @param repository + */ + public IdTokenServiceImpl(JpaIdTokenRepository idTokenRepository) { + this.idTokenRepository = idTokenRepository; + } + + @Override + public void save(IdToken idToken) { + idTokenRepository.save(idToken); + } + + @Override + public IdToken getById(Long id) { + return idTokenRepository.getById(id); + } + + @Override + public void remove(IdToken idToken) { + idTokenRepository.remove(idToken); + } + + @Override + public void removeById(Long id) { + idTokenRepository.removeById(id); + } + +} diff --git a/server/src/main/java/org/mitre/openid/connect/service/impl/UserInfoServiceImpl.java b/server/src/main/java/org/mitre/openid/connect/service/impl/UserInfoServiceImpl.java new file mode 100644 index 000000000..8b49bc8e1 --- /dev/null +++ b/server/src/main/java/org/mitre/openid/connect/service/impl/UserInfoServiceImpl.java @@ -0,0 +1,59 @@ +package org.mitre.openid.connect.service.impl; + +import org.mitre.openid.connect.model.UserInfo; +import org.mitre.openid.connect.repository.impl.JpaUserInfoRepository; +import org.mitre.openid.connect.service.UserInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * Implementation of the UserInfoService + * + * @author Michael Joseph Walsh + * + */ +@Service +@Transactional +public class UserInfoServiceImpl implements UserInfoService { + + @Autowired + private JpaUserInfoRepository userInfoRepository; + + /** + * Default constructor + */ + public UserInfoServiceImpl() { + + } + + /** + * Constructor for use in test harnesses. + * + * @param repository + */ + public UserInfoServiceImpl(JpaUserInfoRepository userInfoRepository) { + this.userInfoRepository = userInfoRepository; + } + + @Override + public void save(UserInfo userInfo) { + userInfoRepository.save(userInfo); + } + + @Override + public UserInfo getByUserId(String userId) { + return userInfoRepository.getByUserId(userId); + } + + @Override + public void remove(UserInfo userInfo) { + userInfoRepository.remove(userInfo); + } + + @Override + public void removeByUserId(String userId) { + userInfoRepository.removeByUserId(userId); + } + +} diff --git a/server/src/main/java/org/mitre/openid/connect/service/impl/WhitelistedSiteServiceImpl.java b/server/src/main/java/org/mitre/openid/connect/service/impl/WhitelistedSiteServiceImpl.java new file mode 100644 index 000000000..78d3ce576 --- /dev/null +++ b/server/src/main/java/org/mitre/openid/connect/service/impl/WhitelistedSiteServiceImpl.java @@ -0,0 +1,59 @@ +package org.mitre.openid.connect.service.impl; + +import org.mitre.openid.connect.model.WhitelistedSite; +import org.mitre.openid.connect.repository.impl.JpaWhitelistedSiteRepository; +import org.mitre.openid.connect.service.WhitelistedSiteService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * Implementation of the WhitelistedSiteService + * + * @author Michael Joseph Walsh + * + */ +@Service +@Transactional +public class WhitelistedSiteServiceImpl implements WhitelistedSiteService { + + @Autowired + private JpaWhitelistedSiteRepository whitelistedSiteRepository; + + /** + * Default constructor + */ + public WhitelistedSiteServiceImpl() { + + } + + /** + * Constructor for use in test harnesses. + * + * @param repository + */ + public WhitelistedSiteServiceImpl( + JpaWhitelistedSiteRepository whitelistedSiteRepository) { + this.whitelistedSiteRepository = whitelistedSiteRepository; + } + + @Override + public WhitelistedSite getById(Long id) { + return whitelistedSiteRepository.getById(id); + } + + @Override + public void remove(WhitelistedSite whitelistedSite) { + whitelistedSiteRepository.remove(whitelistedSite); + } + + @Override + public void removeById(Long id) { + } + + @Override + public WhitelistedSite save(WhitelistedSite whitelistedSite) { + return whitelistedSiteRepository.save(whitelistedSite); + } + +} diff --git a/server/src/main/java/org/mitre/openid/connect/service/impl/empty.txt b/server/src/main/java/org/mitre/openid/connect/service/impl/empty.txt deleted file mode 100644 index e69de29bb..000000000