add JsonObject export for JWK keys

pull/124/head
Samuel Sayer 13 years ago
parent 319568d971
commit 1dd2aaf8a1

@ -51,6 +51,14 @@ public abstract class AbstractJwk implements Jwk{
public void setUse(String use) {
this.use = use;
}
public JsonObject toJsonObject() {
JsonObject export = new JsonObject();
export.addProperty(ALGORITHM, getAlg());
export.addProperty(USE, getUse());
export.addProperty(KEY_ID, getKid());
return export;
}
protected void init(JsonObject object){
if(object.get(ALGORITHM) != null){

@ -55,6 +55,17 @@ public class EC extends AbstractJwk{
super(object);
}
@Override
public JsonObject toJsonObject() {
JsonObject obj = super.toJsonObject();
obj.addProperty(CURVE, getCrv());
obj.addProperty(X, getX());
obj.addProperty(Y, getY());
return obj;
}
public void init(JsonObject object){
super.init(object);
setCrv(object.get(CURVE).getAsString());

@ -46,6 +46,17 @@ public class Rsa extends AbstractJwk{
setMod(object.get(MODULUS).getAsString());
setExp(object.get(EXPONENT).getAsString());
}
@Override
public JsonObject toJsonObject() {
JsonObject export = super.toJsonObject();
export.addProperty(MODULUS, getMod());
export.addProperty(EXPONENT, getExp());
return export;
}
@Override
public PublicKey getKey() throws NoSuchAlgorithmException, InvalidKeySpecException {

@ -274,7 +274,7 @@ public class ClientDetailsEntity implements ClientDetails {
@Override
@Basic
public Integer getAccessTokenValiditySeconds() {
public int getAccessTokenValiditySeconds() {
return accessTokenValiditySeconds;
}
@ -288,7 +288,7 @@ public class ClientDetailsEntity implements ClientDetails {
@Override
@Basic
public Integer getRefreshTokenValiditySeconds() {
public int getRefreshTokenValiditySeconds() {
return refreshTokenValiditySeconds;
}

Loading…
Cancel
Save