fixed split client views, fixed typos in various places
parent
f07c31bbe2
commit
70b2342864
|
@ -97,7 +97,7 @@ public class ClientDetailsEntity implements ClientDetails {
|
||||||
|
|
||||||
private JWSAlgorithmEmbed idTokenSignedResponseAlg; // id_token_signed_response_alg
|
private JWSAlgorithmEmbed idTokenSignedResponseAlg; // id_token_signed_response_alg
|
||||||
private JWEAlgorithmEmbed idTokenEncryptedResponseAlg; // id_token_encrypted_response_alg
|
private JWEAlgorithmEmbed idTokenEncryptedResponseAlg; // id_token_encrypted_response_alg
|
||||||
private JWEEncryptionMethodEmbed idTokenEncryptedReponseEnc; // id_token_encrypted_response_enc
|
private JWEEncryptionMethodEmbed idTokenEncryptedResponseEnc; // id_token_encrypted_response_enc
|
||||||
|
|
||||||
private Integer defaultMaxAge; // default_max_age
|
private Integer defaultMaxAge; // default_max_age
|
||||||
private Boolean requireAuthTime; // require_auth_time
|
private Boolean requireAuthTime; // require_auth_time
|
||||||
|
@ -734,12 +734,12 @@ public class ClientDetailsEntity implements ClientDetails {
|
||||||
@AttributeOverrides({
|
@AttributeOverrides({
|
||||||
@AttributeOverride(name = "algorithmName", column=@Column(name="id_token_encrypted_response_enc"))
|
@AttributeOverride(name = "algorithmName", column=@Column(name="id_token_encrypted_response_enc"))
|
||||||
})
|
})
|
||||||
public JWEEncryptionMethodEmbed getIdTokenEncryptedReponseEnc() {
|
public JWEEncryptionMethodEmbed getIdTokenEncryptedResponseEnc() {
|
||||||
return idTokenEncryptedReponseEnc;
|
return idTokenEncryptedResponseEnc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIdTokenEncryptedReponseEnc(JWEEncryptionMethodEmbed idTokenEncryptedReponseEnc) {
|
public void setIdTokenEncryptedResponseEnc(JWEEncryptionMethodEmbed idTokenEncryptedResponseEnc) {
|
||||||
this.idTokenEncryptedReponseEnc = idTokenEncryptedReponseEnc;
|
this.idTokenEncryptedResponseEnc = idTokenEncryptedResponseEnc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
|
|
|
@ -0,0 +1,107 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.mitre.openid.connect.view;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.Writer;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.mitre.jose.JWEAlgorithmEmbed;
|
||||||
|
import org.mitre.jose.JWEEncryptionMethodEmbed;
|
||||||
|
import org.mitre.jose.JWSAlgorithmEmbed;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.validation.BeanPropertyBindingResult;
|
||||||
|
import org.springframework.web.servlet.view.AbstractView;
|
||||||
|
|
||||||
|
import com.google.gson.ExclusionStrategy;
|
||||||
|
import com.google.gson.FieldAttributes;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.GsonBuilder;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import com.google.gson.JsonPrimitive;
|
||||||
|
import com.google.gson.JsonSerializationContext;
|
||||||
|
import com.google.gson.JsonSerializer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jricher
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public abstract class AbstractClientEntityView extends AbstractView {
|
||||||
|
private static Logger logger = LoggerFactory.getLogger(ClientEntityViewForAdmins.class);
|
||||||
|
|
||||||
|
private Gson gson = new GsonBuilder()
|
||||||
|
.setExclusionStrategies(getExclusionStrategy())
|
||||||
|
.registerTypeAdapter(JWSAlgorithmEmbed.class, new JsonSerializer<JWSAlgorithmEmbed>() {
|
||||||
|
@Override
|
||||||
|
public JsonElement serialize(JWSAlgorithmEmbed src, Type typeOfSrc, JsonSerializationContext context) {
|
||||||
|
if (src != null) {
|
||||||
|
return new JsonPrimitive(src.getAlgorithmName());
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.registerTypeAdapter(JWEAlgorithmEmbed.class, new JsonSerializer<JWEAlgorithmEmbed>() {
|
||||||
|
@Override
|
||||||
|
public JsonElement serialize(JWEAlgorithmEmbed src, Type typeOfSrc, JsonSerializationContext context) {
|
||||||
|
if (src != null) {
|
||||||
|
return new JsonPrimitive(src.getAlgorithmName());
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.registerTypeAdapter(JWEEncryptionMethodEmbed.class, new JsonSerializer<JWEEncryptionMethodEmbed>() {
|
||||||
|
@Override
|
||||||
|
public JsonElement serialize(JWEEncryptionMethodEmbed src, Type typeOfSrc, JsonSerializationContext context) {
|
||||||
|
if (src != null) {
|
||||||
|
return new JsonPrimitive(src.getAlgorithmName());
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.serializeNulls()
|
||||||
|
.setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||||
|
.create();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected abstract ExclusionStrategy getExclusionStrategy();
|
||||||
|
|
||||||
|
|
||||||
|
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
|
||||||
|
response.setContentType("application/json");
|
||||||
|
|
||||||
|
|
||||||
|
HttpStatus code = (HttpStatus) model.get("code");
|
||||||
|
if (code == null) {
|
||||||
|
code = HttpStatus.OK; // default to 200
|
||||||
|
}
|
||||||
|
|
||||||
|
response.setStatus(code.value());
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
Writer out = response.getWriter();
|
||||||
|
Object obj = model.get("entity");
|
||||||
|
gson.toJson(obj, out);
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
|
||||||
|
logger.error("IOException in JsonEntityView.java: ", e);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -36,13 +36,14 @@ import com.google.gson.JsonSerializer;
|
||||||
* @author jricher
|
* @author jricher
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Component("clientEntityViewAdmin")
|
@Component("clientEntityViewAdmins")
|
||||||
public class ClientEntityViewForAdmins extends AbstractView {
|
public class ClientEntityViewForAdmins extends AbstractClientEntityView {
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(ClientEntityViewForAdmins.class);
|
/**
|
||||||
|
* @return
|
||||||
private Gson gson = new GsonBuilder()
|
*/
|
||||||
.setExclusionStrategies(new ExclusionStrategy() {
|
protected ExclusionStrategy getExclusionStrategy() {
|
||||||
|
return new ExclusionStrategy() {
|
||||||
|
|
||||||
public boolean shouldSkipField(FieldAttributes f) {
|
public boolean shouldSkipField(FieldAttributes f) {
|
||||||
if (f.getName().equals("additionalProperties")) {
|
if (f.getName().equals("additionalProperties")) {
|
||||||
|
@ -60,65 +61,6 @@ public class ClientEntityViewForAdmins extends AbstractView {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
};
|
||||||
.registerTypeAdapter(JWSAlgorithmEmbed.class, new JsonSerializer<JWSAlgorithmEmbed>() {
|
|
||||||
@Override
|
|
||||||
public JsonElement serialize(JWSAlgorithmEmbed src, Type typeOfSrc, JsonSerializationContext context) {
|
|
||||||
if (src != null) {
|
|
||||||
return new JsonPrimitive(src.getAlgorithmName());
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.registerTypeAdapter(JWEAlgorithmEmbed.class, new JsonSerializer<JWEAlgorithmEmbed>() {
|
|
||||||
@Override
|
|
||||||
public JsonElement serialize(JWEAlgorithmEmbed src, Type typeOfSrc, JsonSerializationContext context) {
|
|
||||||
if (src != null) {
|
|
||||||
return new JsonPrimitive(src.getAlgorithmName());
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.registerTypeAdapter(JWEEncryptionMethodEmbed.class, new JsonSerializer<JWEEncryptionMethodEmbed>() {
|
|
||||||
@Override
|
|
||||||
public JsonElement serialize(JWEEncryptionMethodEmbed src, Type typeOfSrc, JsonSerializationContext context) {
|
|
||||||
if (src != null) {
|
|
||||||
return new JsonPrimitive(src.getAlgorithmName());
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.serializeNulls()
|
|
||||||
.setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")
|
|
||||||
.create();
|
|
||||||
|
|
||||||
|
|
||||||
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) {
|
|
||||||
|
|
||||||
response.setContentType("application/json");
|
|
||||||
|
|
||||||
|
|
||||||
HttpStatus code = (HttpStatus) model.get("code");
|
|
||||||
if (code == null) {
|
|
||||||
code = HttpStatus.OK; // default to 200
|
|
||||||
}
|
|
||||||
|
|
||||||
response.setStatus(code.value());
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
Writer out = response.getWriter();
|
|
||||||
Object obj = model.get("entity");
|
|
||||||
gson.toJson(obj, out);
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
|
|
||||||
logger.error("IOException in JsonEntityView.java: ", e);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,14 +36,16 @@ import com.google.gson.JsonSerializer;
|
||||||
* @author jricher
|
* @author jricher
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Component("clientEntityViewUser")
|
@Component("clientEntityViewUsers")
|
||||||
public class ClientEntityViewForUsers extends AbstractView {
|
public class ClientEntityViewForUsers extends AbstractClientEntityView {
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(ClientEntityViewForUsers.class);
|
/* (non-Javadoc)
|
||||||
|
* @see org.mitre.openid.connect.view.AbstractClientEntityView#getExclusionStrategy()
|
||||||
private Gson gson = new GsonBuilder()
|
*/
|
||||||
.setExclusionStrategies(new ExclusionStrategy() {
|
@Override
|
||||||
|
protected ExclusionStrategy getExclusionStrategy() {
|
||||||
|
return new ExclusionStrategy() {
|
||||||
|
|
||||||
public boolean shouldSkipField(FieldAttributes f) {
|
public boolean shouldSkipField(FieldAttributes f) {
|
||||||
// whitelist the handful of fields that are good
|
// whitelist the handful of fields that are good
|
||||||
if (f.getName().equals("clientName") ||
|
if (f.getName().equals("clientName") ||
|
||||||
|
@ -66,65 +68,7 @@ public class ClientEntityViewForUsers extends AbstractView {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
};
|
||||||
.registerTypeAdapter(JWSAlgorithmEmbed.class, new JsonSerializer<JWSAlgorithmEmbed>() {
|
|
||||||
@Override
|
|
||||||
public JsonElement serialize(JWSAlgorithmEmbed src, Type typeOfSrc, JsonSerializationContext context) {
|
|
||||||
if (src != null) {
|
|
||||||
return new JsonPrimitive(src.getAlgorithmName());
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.registerTypeAdapter(JWEAlgorithmEmbed.class, new JsonSerializer<JWEAlgorithmEmbed>() {
|
|
||||||
@Override
|
|
||||||
public JsonElement serialize(JWEAlgorithmEmbed src, Type typeOfSrc, JsonSerializationContext context) {
|
|
||||||
if (src != null) {
|
|
||||||
return new JsonPrimitive(src.getAlgorithmName());
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.registerTypeAdapter(JWEEncryptionMethodEmbed.class, new JsonSerializer<JWEEncryptionMethodEmbed>() {
|
|
||||||
@Override
|
|
||||||
public JsonElement serialize(JWEEncryptionMethodEmbed src, Type typeOfSrc, JsonSerializationContext context) {
|
|
||||||
if (src != null) {
|
|
||||||
return new JsonPrimitive(src.getAlgorithmName());
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.serializeNulls()
|
|
||||||
.setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")
|
|
||||||
.create();
|
|
||||||
|
|
||||||
|
|
||||||
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) {
|
|
||||||
|
|
||||||
response.setContentType("application/json");
|
|
||||||
|
|
||||||
|
|
||||||
HttpStatus code = (HttpStatus) model.get("code");
|
|
||||||
if (code == null) {
|
|
||||||
code = HttpStatus.OK; // default to 200
|
|
||||||
}
|
|
||||||
|
|
||||||
response.setStatus(code.value());
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
Writer out = response.getWriter();
|
|
||||||
Object obj = model.get("entity");
|
|
||||||
gson.toJson(obj, out);
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
|
|
||||||
logger.error("IOException in JsonEntityView.java: ", e);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ public class ClientInformationResponseView extends AbstractView {
|
||||||
o.addProperty("userinfo_encrypted_response_enc", c.getUserInfoEncryptedResponseEnc() != null ? c.getUserInfoEncryptedResponseEnc().getAlgorithmName() : null);
|
o.addProperty("userinfo_encrypted_response_enc", c.getUserInfoEncryptedResponseEnc() != null ? c.getUserInfoEncryptedResponseEnc().getAlgorithmName() : null);
|
||||||
o.addProperty("id_token_signed_response_alg", c.getIdTokenSignedResponseAlg() != null ? c.getIdTokenSignedResponseAlg().getAlgorithmName() : null);
|
o.addProperty("id_token_signed_response_alg", c.getIdTokenSignedResponseAlg() != null ? c.getIdTokenSignedResponseAlg().getAlgorithmName() : null);
|
||||||
o.addProperty("id_token_encrypted_response_alg", c.getIdTokenEncryptedResponseAlg() != null ? c.getIdTokenEncryptedResponseAlg().getAlgorithmName() : null);
|
o.addProperty("id_token_encrypted_response_alg", c.getIdTokenEncryptedResponseAlg() != null ? c.getIdTokenEncryptedResponseAlg().getAlgorithmName() : null);
|
||||||
o.addProperty("id_token_encrypted_response_enc", c.getIdTokenEncryptedReponseEnc() != null ? c.getIdTokenEncryptedReponseEnc().getAlgorithmName() : null);
|
o.addProperty("id_token_encrypted_response_enc", c.getIdTokenEncryptedResponseEnc() != null ? c.getIdTokenEncryptedResponseEnc().getAlgorithmName() : null);
|
||||||
o.addProperty("default_max_age", c.getDefaultMaxAge());
|
o.addProperty("default_max_age", c.getDefaultMaxAge());
|
||||||
o.addProperty("require_auth_time", c.getRequireAuthTime());
|
o.addProperty("require_auth_time", c.getRequireAuthTime());
|
||||||
o.add("default_acr_values", getAsArray(c.getDefaultACRvalues()));
|
o.add("default_acr_values", getAsArray(c.getDefaultACRvalues()));
|
||||||
|
|
|
@ -106,7 +106,7 @@ public class ClientAPI {
|
||||||
|
|
||||||
Collection<ClientDetailsEntity> clients = clientService.getAllClients();
|
Collection<ClientDetailsEntity> clients = clientService.getAllClients();
|
||||||
modelAndView.addObject("entity", clients);
|
modelAndView.addObject("entity", clients);
|
||||||
modelAndView.setViewName("clientEntityView");
|
modelAndView.setViewName("clientEntityViewAdmins");
|
||||||
|
|
||||||
return modelAndView;
|
return modelAndView;
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ public class ClientAPI {
|
||||||
ClientDetailsEntity newClient = clientService.saveNewClient(client);
|
ClientDetailsEntity newClient = clientService.saveNewClient(client);
|
||||||
m.addAttribute("entity", newClient);
|
m.addAttribute("entity", newClient);
|
||||||
|
|
||||||
return "clientEntityView";
|
return "clientEntityViewAdmins";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -185,7 +185,7 @@ public class ClientAPI {
|
||||||
ClientDetailsEntity newClient = clientService.updateClient(oldClient, client);
|
ClientDetailsEntity newClient = clientService.updateClient(oldClient, client);
|
||||||
m.addAttribute("entity", newClient);
|
m.addAttribute("entity", newClient);
|
||||||
|
|
||||||
return "clientEntityView";
|
return "clientEntityViewAdmins";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -224,7 +224,7 @@ public class ClientAPI {
|
||||||
}
|
}
|
||||||
|
|
||||||
modelAndView.addObject("entity", client);
|
modelAndView.addObject("entity", client);
|
||||||
modelAndView.setViewName("clientEntityView");
|
modelAndView.setViewName("clientEntityViewAdmins");
|
||||||
|
|
||||||
return modelAndView;
|
return modelAndView;
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,7 +205,7 @@ public class ClientDynamicRegistrationEndpoint {
|
||||||
|
|
||||||
c.setIdTokenSignedResponseAlg(getAsJwsAlgorithm(o, "id_token_signed_response_alg"));
|
c.setIdTokenSignedResponseAlg(getAsJwsAlgorithm(o, "id_token_signed_response_alg"));
|
||||||
c.setIdTokenEncryptedResponseAlg(getAsJweAlgorithm(o, "id_token_encrypted_response_alg"));
|
c.setIdTokenEncryptedResponseAlg(getAsJweAlgorithm(o, "id_token_encrypted_response_alg"));
|
||||||
c.setIdTokenEncryptedReponseEnc(getAsJweEncryptionMethod(o, "id_token_encrypted_response_enc"));
|
c.setIdTokenEncryptedResponseEnc(getAsJweEncryptionMethod(o, "id_token_encrypted_response_enc"));
|
||||||
|
|
||||||
if (o.has("default_max_age")) {
|
if (o.has("default_max_age")) {
|
||||||
if (o.get("default_max_age").isJsonPrimitive()) {
|
if (o.get("default_max_age").isJsonPrimitive()) {
|
||||||
|
|
|
@ -495,7 +495,7 @@ var ClientFormView = Backbone.View.extend({
|
||||||
$('#requestUris .controls', this.el).html(new ListWidgetView({
|
$('#requestUris .controls', this.el).html(new ListWidgetView({
|
||||||
type: 'uri',
|
type: 'uri',
|
||||||
placeholder: 'http://',
|
placeholder: 'http://',
|
||||||
collection: this.requestUrisCollection}).render.el());
|
collection: this.requestUrisCollection}).render().el);
|
||||||
|
|
||||||
// build and bind default ACR values
|
// build and bind default ACR values
|
||||||
_.each(this.model.get('defaultAcrValues'), function (defaultAcrValue) {
|
_.each(this.model.get('defaultAcrValues'), function (defaultAcrValue) {
|
||||||
|
@ -505,7 +505,7 @@ var ClientFormView = Backbone.View.extend({
|
||||||
$('#defaultAcrValues .controls', this.el).html(new ListWidgetView({
|
$('#defaultAcrValues .controls', this.el).html(new ListWidgetView({
|
||||||
placeholder: 'new ACR value',
|
placeholder: 'new ACR value',
|
||||||
// TODO: autocomplete from spec
|
// TODO: autocomplete from spec
|
||||||
collection: this.defaultAcrValuesCollection}).render.el());
|
collection: this.defaultAcrValuesCollection}).render().el);
|
||||||
|
|
||||||
// build and bind
|
// build and bind
|
||||||
|
|
||||||
|
|
|
@ -482,6 +482,7 @@
|
||||||
<option value="ES256" <%=userInfoSignedResponseAlg == "ES256" ? 'selected' : ''%>>ECDSA using P-256 curve and SHA-256 hash algorithm</option>
|
<option value="ES256" <%=userInfoSignedResponseAlg == "ES256" ? 'selected' : ''%>>ECDSA using P-256 curve and SHA-256 hash algorithm</option>
|
||||||
<option value="ES384" <%=userInfoSignedResponseAlg == "ES384" ? 'selected' : ''%>>ECDSA using P-384 curve and SHA-384 hash algorithm</option>
|
<option value="ES384" <%=userInfoSignedResponseAlg == "ES384" ? 'selected' : ''%>>ECDSA using P-384 curve and SHA-384 hash algorithm</option>
|
||||||
<option value="ES512" <%=userInfoSignedResponseAlg == "ES512" ? 'selected' : ''%>>ECDSA using P-512 curve and SHA-512 hash algorithm</option>
|
<option value="ES512" <%=userInfoSignedResponseAlg == "ES512" ? 'selected' : ''%>>ECDSA using P-512 curve and SHA-512 hash algorithm</option>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue