Added initial files for nonce service. Repository and service impls are stubs
parent
cbcfe55bb9
commit
c7ae315e98
|
@ -0,0 +1,43 @@
|
||||||
|
package org.mitre.openid.connect.client;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit test for AbstractOIDCAuthenticationFilter
|
||||||
|
*
|
||||||
|
* @author amanda
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
//@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
|
//@ContextConfiguration(locations = { "classpath:test-context.xml" })
|
||||||
|
public class AbstractOIDCAuthenticationFilterTest {
|
||||||
|
|
||||||
|
//@Autowired
|
||||||
|
private AbstractOIDCAuthenticationFilter filter;
|
||||||
|
|
||||||
|
//@Test
|
||||||
|
public void testUrlConstruction() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the filter
|
||||||
|
*/
|
||||||
|
public AbstractOIDCAuthenticationFilter getFilter() {
|
||||||
|
return filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param filter the filter to set
|
||||||
|
*/
|
||||||
|
public void setFilter(AbstractOIDCAuthenticationFilter filter) {
|
||||||
|
this.filter = filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,104 @@
|
||||||
|
package org.mitre.openid.connect.model;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import javax.persistence.Basic;
|
||||||
|
import javax.persistence.Column;
|
||||||
|
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.Temporal;
|
||||||
|
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name="client_nonce")
|
||||||
|
@NamedQueries({
|
||||||
|
@NamedQuery(name = "Nonce.getAll", query = "select n from Nonce n"),
|
||||||
|
@NamedQuery(name = "Nonce.getByClientId", query = "select n from Nonce n where n.clientId = :clientId"),
|
||||||
|
@NamedQuery(name = "Nonce.getExpired", query = "select n from Nonce n where n.expireDate < now()")
|
||||||
|
})
|
||||||
|
public class Nonce {
|
||||||
|
|
||||||
|
|
||||||
|
private Long id; //the ID of this Nonce
|
||||||
|
|
||||||
|
private String clientId;//The id of the client who used this Nonce
|
||||||
|
|
||||||
|
private Date useDate; //the date this Nonce was used
|
||||||
|
|
||||||
|
private Date expireDate; //the date after which this Nonce should be removed from the database
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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 clientId
|
||||||
|
*/
|
||||||
|
@Basic
|
||||||
|
@Column(name="client_id")
|
||||||
|
public String getClientId() {
|
||||||
|
return clientId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param clientId the clientId to set
|
||||||
|
*/
|
||||||
|
public void setClientId(String clientId) {
|
||||||
|
this.clientId = clientId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the useDate
|
||||||
|
*/
|
||||||
|
@Basic
|
||||||
|
@Temporal(javax.persistence.TemporalType.TIMESTAMP)
|
||||||
|
@Column(name="use_date")
|
||||||
|
public Date getUseDate() {
|
||||||
|
return useDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param useDate the useDate to set
|
||||||
|
*/
|
||||||
|
public void setUseDate(Date useDate) {
|
||||||
|
this.useDate = useDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the expireDate
|
||||||
|
*/
|
||||||
|
@Basic
|
||||||
|
@Temporal(javax.persistence.TemporalType.TIMESTAMP)
|
||||||
|
@Column(name="expire_date")
|
||||||
|
public Date getExpireDate() {
|
||||||
|
return expireDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param expireDate the expireDate to set
|
||||||
|
*/
|
||||||
|
public void setExpireDate(Date expireDate) {
|
||||||
|
this.expireDate = expireDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
package org.mitre.openid.connect.repository;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import org.mitre.openid.connect.model.Nonce;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Nonce repository interface.
|
||||||
|
*
|
||||||
|
* @author Amanda Anganes
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface NonceRepository {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the nonce with the given ID
|
||||||
|
*
|
||||||
|
* @param id the ID of the nonce to find
|
||||||
|
* @return the nonce, if found
|
||||||
|
*/
|
||||||
|
public Nonce getById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the given Nonce from the database
|
||||||
|
*
|
||||||
|
* @param nonce the Nonce to remove
|
||||||
|
*/
|
||||||
|
public void remove(Nonce nonce);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save a new Nonce in the database
|
||||||
|
*
|
||||||
|
* @param nonce the Nonce to save
|
||||||
|
* @return the saved Nonce
|
||||||
|
*/
|
||||||
|
public Nonce save(Nonce nonce);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all nonces stored in the database
|
||||||
|
*
|
||||||
|
* @return the set of nonces
|
||||||
|
*/
|
||||||
|
public Collection<Nonce> getAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all expired nonces stored in the database
|
||||||
|
*
|
||||||
|
* @return the set of expired nonces
|
||||||
|
*/
|
||||||
|
public Collection<Nonce> getExpired();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the set of nonces registered to the given client ID
|
||||||
|
*
|
||||||
|
* @param clientId the client ID
|
||||||
|
* @return the set of nonces registered to the client
|
||||||
|
*/
|
||||||
|
public Collection<Nonce> getByClientId(String clientId);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
package org.mitre.openid.connect.service;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
import org.mitre.openid.connect.model.Nonce;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Nonce service interface
|
||||||
|
*
|
||||||
|
* @author Amanda Anganes
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface NonceService {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the nonce with the given ID
|
||||||
|
*
|
||||||
|
* @param id the ID of the nonce to find
|
||||||
|
* @return the nonce, if found
|
||||||
|
*/
|
||||||
|
public Nonce getById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the given Nonce from the database
|
||||||
|
*
|
||||||
|
* @param nonce the Nonce to remove
|
||||||
|
*/
|
||||||
|
public void remove(Nonce nonce);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save a new Nonce in the database
|
||||||
|
*
|
||||||
|
* @param nonce the Nonce to save
|
||||||
|
* @return the saved Nonce
|
||||||
|
*/
|
||||||
|
public Nonce save(Nonce nonce);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all nonces stored in the database
|
||||||
|
*
|
||||||
|
* @return the set of nonces
|
||||||
|
*/
|
||||||
|
public Collection<Nonce> getAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all expired nonces stored in the database
|
||||||
|
*
|
||||||
|
* @return the set of expired nonces
|
||||||
|
*/
|
||||||
|
public Collection<Nonce> getExpired();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the set of nonces registered to the given client ID
|
||||||
|
*
|
||||||
|
* @param clientId the client ID
|
||||||
|
* @return the set of nonces registered to the client
|
||||||
|
*/
|
||||||
|
public Collection<Nonce> getByClientId(String clientId);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
package org.mitre.openid.connect.repository.impl;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
import org.mitre.openid.connect.model.Nonce;
|
||||||
|
import org.mitre.openid.connect.repository.NonceRepository;
|
||||||
|
|
||||||
|
public class JpaNonceRepository implements NonceRepository {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Nonce getById(Long id) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remove(Nonce nonce) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Nonce save(Nonce nonce) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<Nonce> getAll() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<Nonce> getExpired() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<Nonce> getByClientId(String clientId) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
package org.mitre.openid.connect.service.impl;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
import org.mitre.openid.connect.model.Nonce;
|
||||||
|
import org.mitre.openid.connect.service.NonceService;
|
||||||
|
|
||||||
|
public class DefaultNonceService implements NonceService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Nonce getById(Long id) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remove(Nonce nonce) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Nonce save(Nonce nonce) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<Nonce> getAll() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<Nonce> getExpired() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<Nonce> getByClientId(String clientId) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue