mods to repository, added service interfaces and impls

pull/59/head
Michael Joseph Walsh 2012-01-25 15:48:51 -05:00
parent a81dd8d5a4
commit 7cd799a372
30 changed files with 905 additions and 25 deletions

View File

@ -5,11 +5,6 @@
<projects> <projects>
</projects> </projects>
<buildSpec> <buildSpec>
<buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand> <buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name> <name>org.eclipse.m2e.core.maven2Builder</name>
<arguments> <arguments>
@ -18,6 +13,5 @@
</buildSpec> </buildSpec>
<natures> <natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature> <nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
</natures> </natures>
</projectDescription> </projectDescription>

View File

@ -0,0 +1,5 @@
#Wed Jan 25 10:37:18 EST 2012
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

View File

@ -1,4 +1,4 @@
#Wed Jan 04 13:38:09 EST 2012 #Wed Jan 25 10:37:18 EST 2012
activeProfiles= activeProfiles=
eclipse.preferences.version=1 eclipse.preferences.version=1
fullBuildGoals=process-test-resources fullBuildGoals=process-test-resources

View File

@ -10,10 +10,5 @@
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/> <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/> <classpathentry kind="output" path="target/classes"/>
</classpath> </classpath>

View File

@ -26,11 +26,6 @@
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand> <buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name> <name>org.eclipse.m2e.core.maven2Builder</name>
<arguments> <arguments>
@ -38,12 +33,11 @@
</buildCommand> </buildCommand>
</buildSpec> </buildSpec>
<natures> <natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature> <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature> <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature> <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature> <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures> </natures>
</projectDescription> </projectDescription>

View File

@ -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 com.springsource.sts.maven.maven.automatically.update=true
eclipse.preferences.version=1 eclipse.preferences.version=1

View File

@ -0,0 +1,5 @@
#Wed Jan 25 10:37:18 EST 2012
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

View File

@ -3,8 +3,8 @@
<wb-module deploy-name="openid"> <wb-module deploy-name="openid">
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/> <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<dependent-module archiveName="spring-security-oauth2-1.0.0.BUILD-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/spring-security-oauth2/spring-security-oauth2"> <dependent-module archiveName="spring-security-oauth2-1.0.0.BUILD-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/spring-security-oauth2/spring-security-oauth2">
<dependency-type>uses</dependency-type> <dependency-type>uses</dependency-type>
</dependent-module> </dependent-module>

View File

@ -31,7 +31,7 @@ public interface ApprovedSiteRepository {
public Collection<ApprovedSite> getAll(); public Collection<ApprovedSite> 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 * provided ClientDetailsEntity
* *
* @param userId * @param userId
@ -41,7 +41,7 @@ public interface ApprovedSiteRepository {
ClientDetailsEntity clientDetails); 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 * provided UserInfo
* *
* @param userId * @param userId

View File

@ -12,6 +12,15 @@ import org.mitre.openid.connect.model.UserInfo;
*/ */
public interface UserInfoRepository { 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 * Persists a UserInfo
* *
@ -28,6 +37,14 @@ public interface UserInfoRepository {
*/ */
public void remove(UserInfo userInfo); 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 * Return a collection of all UserInfos managed by this repository
* *

View File

@ -9,6 +9,12 @@ import org.mitre.openid.connect.model.IdTokenClaims;
import org.mitre.openid.connect.repository.IdTokenClaimsRepository; import org.mitre.openid.connect.repository.IdTokenClaimsRepository;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
/**
* JPA IdTokenClaims repository implementation
*
* @author Michael Joseph Walsh
*
*/
public class JpaIdTokenClaimsRepository implements IdTokenClaimsRepository { public class JpaIdTokenClaimsRepository implements IdTokenClaimsRepository {
@PersistenceContext @PersistenceContext

View File

@ -9,6 +9,12 @@ import org.mitre.openid.connect.model.IdToken;
import org.mitre.openid.connect.repository.IdTokenRepository; import org.mitre.openid.connect.repository.IdTokenRepository;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
/**
* JPA IdToken repository implementation
*
* @author Michael Joseph Walsh
*
*/
public class JpaIdTokenRepository implements IdTokenRepository { public class JpaIdTokenRepository implements IdTokenRepository {
@PersistenceContext @PersistenceContext

View File

@ -14,7 +14,7 @@ import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
/** /**
* * JPA UserInfo repository implementation * JPA UserInfo repository implementation
* *
* @author Michael Joseph Walsh * @author Michael Joseph Walsh
* *
@ -25,6 +25,12 @@ public class JpaUserInfoRepository implements UserInfoRepository {
@PersistenceContext @PersistenceContext
private EntityManager manager; private EntityManager manager;
@Override
@Transactional
public UserInfo getByUserId(String userId) {
return manager.find(UserInfo.class, userId);
}
@Override @Override
@Transactional @Transactional
public UserInfo save(UserInfo userInfo) { 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 @Override
@Transactional @Transactional
public Collection<UserInfo> getAll() { public Collection<UserInfo> getAll() {
@ -53,4 +71,5 @@ public class JpaUserInfoRepository implements UserInfoRepository {
return query.getResultList(); return query.getResultList();
} }
} }

View File

@ -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<WhitelistedSite> getAll() {
TypedQuery<WhitelistedSite> 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);
}
}

View File

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

View File

@ -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<ApprovedSite> getAll();
/**
* Return a collection of ApprovedSite managed by this repository matching the
* provided ClientDetailsEntity
*
* @param userId
* @return
*/
public Collection<ApprovedSite> getByClientDetails(ClientDetailsEntity clientDetails);
/**
* Return a collection of ApprovedSite managed by this repository matching the
* provided UserInfo
*
* @param userId
* @return
*/
public Collection<ApprovedSite> 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);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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<ApprovedSite> getAll() {
return approvedSiteRepository.getAll();
}
@Override
public Collection<ApprovedSite> getByClientDetails(
ClientDetailsEntity clientDetails) {
return approvedSiteRepository.getByClientDetails(clientDetails);
}
@Override
public Collection<ApprovedSite> 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);
}
}

View File

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

View File

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

View File

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

View File

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

View File

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