Class KERecord
- java.lang.Object
-
- edu.uiuc.ncsa.security.core.util.IdentifiableImpl
-
- edu.uiuc.ncsa.security.storage.monitored.Monitored
-
- org.oa4mp.server.loader.oauth2.storage.keys.KERecord
-
- All Implemented Interfaces:
edu.uiuc.ncsa.security.core.DateComparable,edu.uiuc.ncsa.security.core.Identifiable,Serializable,Cloneable
public class KERecord extends edu.uiuc.ncsa.security.storage.monitored.MonitoredStore entry that models a single JWK key. It contains all the administrative information for the key, as well as the actual key itself.Each key has a VI (no VI means default). Much of this is usually also in the key itself, but pulling it out allows for searching and better management.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Stringalgprotected Dateexpprotected Dateiatprotected BooleanisDefaultprotected BooleanisValidprotected edu.uiuc.ncsa.security.util.jwk.JSONWebKeyjwkprotected Stringkidprotected Stringktyprotected Datenbfprotected Stringuseprotected URIvi
-
Constructor Summary
Constructors Constructor Description KERecord(edu.uiuc.ncsa.security.core.Identifier identifier)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfromJWK(edu.uiuc.ncsa.security.util.jwk.JSONWebKey jwk, boolean isDefault)Imports theJSONWebKeyinto this record.StringgetAlg()BooleangetDefault()DategetExp()DategetIat()edu.uiuc.ncsa.security.util.jwk.JSONWebKeygetJwk()Gets the stored version of this key with little or no acocunting information.StringgetKid()StringgetKty()DategetNbf()StringgetUse()BooleangetValid()URIgetVi()booleanhasValidDate()Checks that the nbf (not before) date has passedbooleanhasVI()If there is a virtual issuer set.booleanisExpired()Has the exp date of this record passed?voidsetAlg(String alg)voidsetDefault(Boolean aDefault)voidsetExp(Date exp)voidsetIat(Date iat)voidsetJwk(edu.uiuc.ncsa.security.util.jwk.JSONWebKey jwk)voidsetKid(String kid)voidsetKty(String kty)voidsetNbf(Date nbf)voidsetUse(String use)voidsetValid(Boolean valid)voidsetVi(URI vi)edu.uiuc.ncsa.security.util.jwk.JSONWebKeytoJWK()Takes this record and returns theJSONWebKeywith all fields set.StringtoString()-
Methods inherited from class edu.uiuc.ncsa.security.storage.monitored.Monitored
clone, equals, getCreationTS, getLastAccessed, getLastModifiedTS, setCreationTS, setLastAccessed, setLastModifiedTS
-
-
-
-
Field Detail
-
alg
protected String alg
-
isValid
protected Boolean isValid
-
exp
protected Date exp
-
iat
protected Date iat
-
isDefault
protected Boolean isDefault
-
jwk
protected edu.uiuc.ncsa.security.util.jwk.JSONWebKey jwk
-
kid
protected String kid
-
kty
protected String kty
-
nbf
protected Date nbf
-
use
protected String use
-
vi
protected URI vi
-
-
Method Detail
-
getAlg
public String getAlg()
-
setAlg
public void setAlg(String alg)
-
getValid
public Boolean getValid()
-
setValid
public void setValid(Boolean valid)
-
getExp
public Date getExp()
-
setExp
public void setExp(Date exp)
-
getIat
public Date getIat()
-
setIat
public void setIat(Date iat)
-
getDefault
public Boolean getDefault()
-
setDefault
public void setDefault(Boolean aDefault)
-
getJwk
public edu.uiuc.ncsa.security.util.jwk.JSONWebKey getJwk()
Gets the stored version of this key with little or no acocunting information. Use thetoJWK()to convert this record to a usuable JWK.- Returns:
-
setJwk
public void setJwk(edu.uiuc.ncsa.security.util.jwk.JSONWebKey jwk)
-
getKid
public String getKid()
-
setKid
public void setKid(String kid)
-
getKty
public String getKty()
-
setKty
public void setKty(String kty)
-
getNbf
public Date getNbf()
-
setNbf
public void setNbf(Date nbf)
-
getUse
public String getUse()
-
setUse
public void setUse(String use)
-
getVi
public URI getVi()
-
setVi
public void setVi(URI vi)
-
hasVI
public boolean hasVI()
If there is a virtual issuer set. No VI means this is in the default issuer.- Returns:
-
fromJWK
public void fromJWK(edu.uiuc.ncsa.security.util.jwk.JSONWebKey jwk, boolean isDefault) throws NoSuchAlgorithmException, InvalidKeySpecExceptionImports theJSONWebKeyinto this record. At the end, the recrod represents the web key. See alsotoJWK().Note
The key is not set valid automatically, since that is not part of the actual key, nor is there a description or virtual issuer set.- Parameters:
jwk-isDefault-- Throws:
NoSuchAlgorithmExceptionInvalidKeySpecException
-
toJWK
public edu.uiuc.ncsa.security.util.jwk.JSONWebKey toJWK() throws NoSuchAlgorithmException, InvalidKeySpecExceptionTakes this record and returns theJSONWebKeywith all fields set. You should use this if you need to export the key for use andgetJwk()if you need the raw, unprocessed key.- Returns:
- Throws:
NoSuchAlgorithmExceptionInvalidKeySpecException
-
isExpired
public boolean isExpired()
Has the exp date of this record passed? True if expired.- Returns:
-
hasValidDate
public boolean hasValidDate()
Checks that the nbf (not before) date has passed- Returns:
-
-