[Users]: 1. Update Uikit. 2. Change regisered service api. 3. fix empty registered service list.
This commit is contained in:
parent
a60b3fedd9
commit
8bb0f9e44f
|
@ -53,7 +53,6 @@ public class RegisterServiceServlet extends HttpServlet {
|
|||
String idParam = request.getParameter("id");
|
||||
|
||||
String serviceName = (String) request.getSession().getAttribute("first_name");
|
||||
String description = (String) request.getSession().getAttribute("description");
|
||||
String keyType = (String) request.getSession().getAttribute("key_radio");
|
||||
String jwksUri = (String) request.getSession().getAttribute("uri");
|
||||
String jwksString = (String) request.getSession().getAttribute("value");
|
||||
|
@ -66,9 +65,9 @@ public class RegisterServiceServlet extends HttpServlet {
|
|||
RegisteredService registeredService = registeredServicesUtils.getRegisteredServiceDao().fetchRegisteredServiceById(id);
|
||||
|
||||
if (registeredService != null && registeredServicesUtils.isAuthorized(userid, id)) {
|
||||
ServiceResponse serviceResponse = tokenUtils.getRegisteredService(registeredService.getAai_id(), authentication.getAccessTokenValue());
|
||||
ServiceResponse serviceResponse = tokenUtils.getRegisteredService(registeredService.getClientId(), registeredService.getRegistrationAccessToken());
|
||||
|
||||
updateFormFields(request, serviceName, description, keyType, serviceResponse);
|
||||
updateFormFields(request, serviceName, keyType, serviceResponse);
|
||||
|
||||
} else {
|
||||
if (registeredService == null) {
|
||||
|
@ -107,17 +106,13 @@ public class RegisterServiceServlet extends HttpServlet {
|
|||
request.getRequestDispatcher("./registerService.jsp").include(request, response);
|
||||
}
|
||||
|
||||
private void updateFormFields(HttpServletRequest request, String serviceName, String description, String keyType, ServiceResponse serviceResponse) {
|
||||
private void updateFormFields(HttpServletRequest request, String serviceName, String keyType, ServiceResponse serviceResponse) {
|
||||
|
||||
System.out.println("UPDATING FORM");
|
||||
if (serviceName == null || serviceName.trim().isEmpty()) {
|
||||
request.getSession().setAttribute("first_name", serviceResponse.getClientName());
|
||||
}
|
||||
|
||||
if (description == null || description.trim().isEmpty()) {
|
||||
request.getSession().setAttribute("description", serviceResponse.getClientDescription());
|
||||
}
|
||||
|
||||
if (keyType == null || keyType.trim().isEmpty()) {
|
||||
System.out.println("Service response URI " + serviceResponse.getJwksUri());
|
||||
if (serviceResponse.getJwksUri() != null) {
|
||||
|
@ -160,8 +155,6 @@ public class RegisterServiceServlet extends HttpServlet {
|
|||
request.getSession().setAttribute("first_name_error", true);
|
||||
canProceed = false;
|
||||
}
|
||||
|
||||
String description = request.getParameter("description").trim();
|
||||
String keyType = request.getParameter("key_radio").trim();
|
||||
String jwksUri = null;
|
||||
String jwksString = null;
|
||||
|
@ -197,18 +190,13 @@ public class RegisterServiceServlet extends HttpServlet {
|
|||
canProceed = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String userid = authentication.getSub();
|
||||
String email = authentication.getUserInfo().getEmail();
|
||||
|
||||
String accessToken = authentication.getAccessTokenValue();
|
||||
|
||||
String serverRequestJSON;
|
||||
if (keyType.equals("uri")){
|
||||
serverRequestJSON = createServiceJson(name, description, email, jwksUri);
|
||||
serverRequestJSON = createServiceJson(name, email, jwksUri);
|
||||
} else {
|
||||
serverRequestJSON = createServiceJson(name, description, email, jwks);
|
||||
serverRequestJSON = createServiceJson(name, email, jwks);
|
||||
}
|
||||
|
||||
System.out.println("SERVER JSON " + serverRequestJSON);
|
||||
|
@ -224,18 +212,18 @@ public class RegisterServiceServlet extends HttpServlet {
|
|||
checkNumberOfRegisteredServices(request, response, authentication);
|
||||
|
||||
|
||||
serverMessage = tokenUtils.registerService(serverRequestJSON, accessToken);
|
||||
|
||||
serverMessage = tokenUtils.registerService(serverRequestJSON);
|
||||
logger.debug(serverMessage);
|
||||
if (serverMessage == null) {
|
||||
request.getSession().setAttribute("message", "There was an error registering your service. Please try again later.");
|
||||
response.sendRedirect("./registeredServices");
|
||||
return;
|
||||
}
|
||||
serviceResponse = new Gson().fromJson(serverMessage, ServiceResponse.class);
|
||||
String aai_id = serviceResponse.getId();
|
||||
String client_id = serviceResponse.getClientId();
|
||||
String owner = userid;
|
||||
|
||||
RegisteredService registeredService = new RegisteredService(aai_id, owner, name);
|
||||
RegisteredService registeredService = new RegisteredService(client_id, owner, name, serviceResponse.getRegistrationAccessToken());
|
||||
|
||||
try {
|
||||
registeredServicesUtils.addRegistedService(registeredService);
|
||||
|
@ -267,15 +255,15 @@ public class RegisterServiceServlet extends HttpServlet {
|
|||
RegisteredService registeredService = null;
|
||||
registeredService = registeredServicesUtils.getRegisteredServiceDao().fetchRegisteredServiceById(serviceIdInt);
|
||||
|
||||
if (registeredService != null && registeredService.getAai_id() != null) {
|
||||
serviceResponse = tokenUtils.getRegisteredService(registeredService.getAai_id(), accessToken);
|
||||
HttpResponse resp = tokenUtils.updateService(registeredService.getAai_id(), serverRequestJSON, accessToken);
|
||||
if (registeredService != null && registeredService.getClientId() != null) {
|
||||
serviceResponse = tokenUtils.getRegisteredService(registeredService.getClientId(), registeredService.getRegistrationAccessToken());
|
||||
HttpResponse resp = tokenUtils.updateService(registeredService.getClientId(), serverRequestJSON, registeredService.getRegistrationAccessToken());
|
||||
|
||||
if (resp.getStatusLine().getStatusCode()==200) {
|
||||
System.out.println("NAME >>>>" + name);
|
||||
registeredService.setName(name);
|
||||
|
||||
System.out.println("AAI ID " + registeredService.getAai_id());
|
||||
System.out.println("Client Id " + registeredService.getClientId());
|
||||
try {
|
||||
registeredServicesUtils.getRegisteredServiceDao().update(registeredService);
|
||||
} catch (SQLException sqle) {
|
||||
|
@ -312,7 +300,6 @@ public class RegisterServiceServlet extends HttpServlet {
|
|||
} else {
|
||||
//something is wrong with the form and the error messages will appear
|
||||
request.getSession().setAttribute("first_name", name);
|
||||
request.getSession().setAttribute("description", description);
|
||||
request.getSession().setAttribute("key_radio", keyType);
|
||||
request.getSession().setAttribute("uri", jwksUri);
|
||||
request.getSession().setAttribute("value", jwksString);
|
||||
|
@ -371,10 +358,9 @@ public class RegisterServiceServlet extends HttpServlet {
|
|||
}
|
||||
}
|
||||
|
||||
private static String createServiceJson(String name, String description, String email, String jwksURI) {
|
||||
private static String createServiceJson(String name, String email, String jwksURI) {
|
||||
ServiceRequest serviceJSON = new ServiceRequest();
|
||||
serviceJSON.setClientName(name);
|
||||
serviceJSON.setClientDescription(description);
|
||||
serviceJSON.setContacts(new String[]{email});
|
||||
serviceJSON.setJwksUri(jwksURI);
|
||||
|
||||
|
@ -385,12 +371,10 @@ public class RegisterServiceServlet extends HttpServlet {
|
|||
return gson.toJson(serviceJSON);
|
||||
}
|
||||
|
||||
private static String createServiceJson(String name, String description, String email, Jwks jwks) {
|
||||
private static String createServiceJson(String name, String email, Jwks jwks) {
|
||||
ServiceRequest serviceJSON = new ServiceRequest();
|
||||
serviceJSON.setClientName(name);
|
||||
serviceJSON.setClientDescription(description);
|
||||
serviceJSON.setContacts(new String[]{email});
|
||||
serviceJSON.setJwksType("VAL");
|
||||
serviceJSON.setJwks(jwks);
|
||||
|
||||
GsonBuilder builder = new GsonBuilder();
|
||||
|
|
|
@ -57,15 +57,14 @@ public class RegisteredServicesServlet extends HttpServlet {
|
|||
getRegisteredServiceDao().fetchAllRegisteredServicesByOwner(userId);
|
||||
System.out.println("LOAD REGISTERED SERVICES. " + registeredServices.size());
|
||||
|
||||
if (registeredServices== null || registeredServices.isEmpty()) {
|
||||
if (registeredServices.isEmpty()) {
|
||||
request.getSession().setAttribute("showEmptyList", true);
|
||||
|
||||
} else {
|
||||
Map<String, ServiceResponse> serviceResponses = new HashMap<>();
|
||||
Map<String, String> serviceKey = new HashMap<>();
|
||||
|
||||
for (RegisteredService registeredService:registeredServices) {
|
||||
ServiceResponse serviceResponse = tokenUtils.getRegisteredService(registeredService.getAai_id(),authentication.getAccessTokenValue());
|
||||
ServiceResponse serviceResponse = tokenUtils.getRegisteredService(registeredService.getClientId(),registeredService.getRegistrationAccessToken());
|
||||
serviceResponses.put(registeredService.getId(), serviceResponse);
|
||||
serviceKey.put(registeredService.getId(), extractPublicKeySet(serviceResponse));
|
||||
}
|
||||
|
@ -79,8 +78,8 @@ public class RegisteredServicesServlet extends HttpServlet {
|
|||
|
||||
request.getSession().setAttribute("services", serviceResponses);
|
||||
request.getSession().setAttribute("keys", serviceKey);
|
||||
request.getSession().setAttribute("registeredServices", registeredServices);
|
||||
}
|
||||
request.getSession().setAttribute("registeredServices", registeredServices);
|
||||
|
||||
} catch (SQLException sqle) {
|
||||
logger.error("Error fetching registered services for user " + userId , sqle);
|
||||
|
@ -126,13 +125,12 @@ public class RegisteredServicesServlet extends HttpServlet {
|
|||
return;
|
||||
}
|
||||
|
||||
String aai_id = registeredService.getAai_id();
|
||||
HttpResponse resp = tokenUtils.deleteService(aai_id, authentication.getAccessTokenValue());
|
||||
HttpResponse resp = tokenUtils.deleteService(registeredService.getClientId(), registeredService.getRegistrationAccessToken());
|
||||
|
||||
int statusCode = resp.getStatusLine().getStatusCode();
|
||||
System.out.println("STATUS CODE " + statusCode);
|
||||
|
||||
if (statusCode != 200) {
|
||||
if (statusCode != 204) {
|
||||
logger.error("Unable to delete the service. Status code was " + statusCode);
|
||||
request.getSession().setAttribute("message", "Fail to delete the service. Status " + statusCode);
|
||||
System.out.println("AAI blocked");
|
||||
|
@ -157,9 +155,6 @@ public class RegisteredServicesServlet extends HttpServlet {
|
|||
}
|
||||
|
||||
private boolean reachedMaximumNumberOfServices(List<RegisteredService> registeredServices) {
|
||||
if (registeredServices.size() == 5) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return registeredServices.size() == 5;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,71 +3,56 @@ package eu.dnetlib.openaire.usermanagement;
|
|||
import java.io.Serializable;
|
||||
|
||||
public class ServiceRequest {
|
||||
String clientName;
|
||||
String clientId;
|
||||
String[] redirectUris = new String[]{};
|
||||
String clientDescription;
|
||||
String logoUri;
|
||||
String policyUri;
|
||||
String client_name;
|
||||
String client_id;
|
||||
String logo_uri;
|
||||
String policy_uri;
|
||||
String[] contacts;
|
||||
String[] scope = new String[]{"openid"};
|
||||
String[] grantTypes = new String[] {"client_credentials"};
|
||||
boolean allowIntrospection = true;
|
||||
String tokenEndpointAuthMethod = "PRIVATE_KEY";
|
||||
String tokenEndpointAuthSigningAlg = "RS256";
|
||||
String jwksType;
|
||||
String jwksUri;
|
||||
String[] redirect_uris = new String[]{};
|
||||
String[] grant_types = new String[] {"client_credentials"};
|
||||
String token_endpoint_auth_method = "private_key_jwt";
|
||||
String token_endpoint_auth_signing_alg = "RS256";
|
||||
String jwks_uri;
|
||||
Jwks jwks;
|
||||
boolean allowRefresh = false;
|
||||
boolean reuseRefreshToken = true;
|
||||
boolean clearAccessTokensOnRefresh = true;
|
||||
|
||||
public String getClientName() {
|
||||
return clientName;
|
||||
return client_name;
|
||||
}
|
||||
|
||||
public void setClientName(String clientName) {
|
||||
this.clientName = clientName;
|
||||
this.client_name = clientName;
|
||||
}
|
||||
|
||||
public String getClientId() {
|
||||
return clientId;
|
||||
return client_id;
|
||||
}
|
||||
|
||||
public void setClientId(String clientId) {
|
||||
this.clientId = clientId;
|
||||
this.client_id = clientId;
|
||||
}
|
||||
|
||||
public String[] getRedirectUris() {
|
||||
return redirectUris;
|
||||
return redirect_uris;
|
||||
}
|
||||
|
||||
public void setRedirectUris(String[] redirectUris) {
|
||||
this.redirectUris = redirectUris;
|
||||
}
|
||||
|
||||
public String getClientDescription() {
|
||||
return clientDescription;
|
||||
}
|
||||
|
||||
public void setClientDescription(String clientDescription) {
|
||||
this.clientDescription = clientDescription;
|
||||
this.redirect_uris = redirectUris;
|
||||
}
|
||||
|
||||
public String getLogoUri() {
|
||||
return logoUri;
|
||||
return logo_uri;
|
||||
}
|
||||
|
||||
public void setLogoUri(String logoUri) {
|
||||
this.logoUri = logoUri;
|
||||
this.logo_uri = logoUri;
|
||||
}
|
||||
|
||||
public String getPolicyUri() {
|
||||
return policyUri;
|
||||
return policy_uri;
|
||||
}
|
||||
|
||||
public void setPolicyUri(String policyUri) {
|
||||
this.policyUri = policyUri;
|
||||
this.policy_uri = policyUri;
|
||||
}
|
||||
|
||||
public String[] getContacts() {
|
||||
|
@ -78,60 +63,36 @@ public class ServiceRequest {
|
|||
this.contacts = contacts;
|
||||
}
|
||||
|
||||
public String[] getScope() {
|
||||
return scope;
|
||||
}
|
||||
|
||||
public void setScope(String[] scope) {
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
public String[] getGrantTypes() {
|
||||
return grantTypes;
|
||||
return grant_types;
|
||||
}
|
||||
|
||||
public void setGrantTypes(String[] grantTypes) {
|
||||
this.grantTypes = grantTypes;
|
||||
this.grant_types = grantTypes;
|
||||
}
|
||||
|
||||
public boolean isAllowIntrospection() {
|
||||
return allowIntrospection;
|
||||
public String getToken_endpoint_auth_method() {
|
||||
return token_endpoint_auth_method;
|
||||
}
|
||||
|
||||
public void setAllowIntrospection(boolean allowIntrospection) {
|
||||
this.allowIntrospection = allowIntrospection;
|
||||
}
|
||||
|
||||
public String getTokenEndpointAuthMethod() {
|
||||
return tokenEndpointAuthMethod;
|
||||
}
|
||||
|
||||
public void setTokenEndpointAuthMethod(String tokenEndpointAuthMethod) {
|
||||
this.tokenEndpointAuthMethod = tokenEndpointAuthMethod;
|
||||
public void setToken_endpoint_auth_method(String token_endpoint_auth_method) {
|
||||
this.token_endpoint_auth_method = token_endpoint_auth_method;
|
||||
}
|
||||
|
||||
public String getTokenEndpointAuthSigningAlg() {
|
||||
return tokenEndpointAuthSigningAlg;
|
||||
return token_endpoint_auth_signing_alg;
|
||||
}
|
||||
|
||||
public void setTokenEndpointAuthSigningAlg(String tokenEndpointAuthSigningAlg) {
|
||||
this.tokenEndpointAuthSigningAlg = tokenEndpointAuthSigningAlg;
|
||||
}
|
||||
|
||||
public String getJwksType() {
|
||||
return jwksType;
|
||||
}
|
||||
|
||||
public void setJwksType(String jwksType) {
|
||||
this.jwksType = jwksType;
|
||||
this.token_endpoint_auth_signing_alg = tokenEndpointAuthSigningAlg;
|
||||
}
|
||||
|
||||
public String getJwksUri() {
|
||||
return jwksUri;
|
||||
return jwks_uri;
|
||||
}
|
||||
|
||||
public void setJwksUri(String jwksUri) {
|
||||
this.jwksUri = jwksUri;
|
||||
this.jwks_uri = jwksUri;
|
||||
}
|
||||
|
||||
public Jwks getJwks() {
|
||||
|
|
|
@ -3,244 +3,91 @@ package eu.dnetlib.openaire.usermanagement;
|
|||
import java.io.Serializable;
|
||||
|
||||
public class ServiceResponse implements Serializable {
|
||||
String id;
|
||||
String clientId;
|
||||
String clientSecret;
|
||||
String[] redirectUris;
|
||||
String clientName;
|
||||
String clienrtUri;
|
||||
String logoUri;
|
||||
String client_id;
|
||||
Long client_id_issued_at;
|
||||
String client_secret;
|
||||
Long client_secret_expires_at;
|
||||
String registration_access_token;
|
||||
String registration_client_uri;
|
||||
String[] redirect_uris;
|
||||
String client_name;
|
||||
String logo_uri;
|
||||
String policy_uri;
|
||||
String[] contacts;
|
||||
String tosUri;
|
||||
String tokenEndpointAuthMethod;
|
||||
String[] scope;
|
||||
String grantTypes[];
|
||||
String responseTypes[];
|
||||
String policyUri;
|
||||
String jwksUri;
|
||||
String[] grant_types;
|
||||
String token_endpoint_auth_method;
|
||||
String token_endpoint_auth_signing_alg;
|
||||
String scope;
|
||||
String jwks_uri;
|
||||
Jwks jwks;
|
||||
String applicationType;
|
||||
String sectorIdentifierUri;
|
||||
String subjectType;
|
||||
String requestObjectSigningAlg;
|
||||
String userInfoSignedResponseAlg;
|
||||
String userInfoEncryptedResponseAlg;
|
||||
String userInfoEncryptedResponseEnc;
|
||||
String idTokenSignedResponseAlg;
|
||||
String idTokenEncryptedResponseAlg;
|
||||
String idTokenEncryptedResponseEnc;
|
||||
String tokenEndpointAuthSigningAlg;
|
||||
String defaultMaxAge;
|
||||
String requireAuthTime;
|
||||
String[] defaultACRvalues;
|
||||
String initiateLoginUri;
|
||||
String[] postLogoutRedirectUris;
|
||||
String[] requestUris;
|
||||
String[] authorities;
|
||||
int accessTokenValiditySeconds;
|
||||
int refreshTokenValiditySeconds;
|
||||
String[] resourceIds;
|
||||
String clientDescription;
|
||||
boolean reuseRefreshToken;
|
||||
boolean dynamicallyRegistered;
|
||||
boolean allowIntrospection;
|
||||
int idTokenValiditySeconds;
|
||||
String createdAt;
|
||||
boolean clearAccessTokensOnRefresh;
|
||||
String deviceCodeValiditySeconds;
|
||||
String[] claimsRedirectUris;
|
||||
String softwareStatement;
|
||||
String codeChallengeMethod;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getClientId() {
|
||||
return clientId;
|
||||
return client_id;
|
||||
}
|
||||
|
||||
public Long getClientIdIssuedAt() {
|
||||
return client_id_issued_at;
|
||||
}
|
||||
|
||||
public String getClientSecret() {
|
||||
return clientSecret;
|
||||
return client_secret;
|
||||
}
|
||||
|
||||
public Long getClientSecretExpiresAt() {
|
||||
return client_secret_expires_at;
|
||||
}
|
||||
|
||||
public String getRegistrationAccessToken() {
|
||||
return registration_access_token;
|
||||
}
|
||||
|
||||
public String getRegistrationClientUri() {
|
||||
return registration_client_uri;
|
||||
}
|
||||
|
||||
public String[] getRedirectUris() {
|
||||
return redirectUris;
|
||||
return redirect_uris;
|
||||
}
|
||||
|
||||
public String getClientName() {
|
||||
return clientName;
|
||||
return client_name;
|
||||
}
|
||||
|
||||
public String getClienrtUri() {
|
||||
return clienrtUri;
|
||||
}
|
||||
|
||||
public String getLogoUri() {
|
||||
return logoUri;
|
||||
return logo_uri;
|
||||
}
|
||||
|
||||
public String getPolicyUri() {
|
||||
return policy_uri;
|
||||
}
|
||||
|
||||
public String[] getContacts() {
|
||||
return contacts;
|
||||
}
|
||||
|
||||
public String getTosUri() {
|
||||
return tosUri;
|
||||
public String[] getGrantTypes() {
|
||||
return grant_types;
|
||||
}
|
||||
|
||||
public String getTokenEndpointAuthMethod() {
|
||||
return tokenEndpointAuthMethod;
|
||||
return token_endpoint_auth_method;
|
||||
}
|
||||
|
||||
public String[] getScope() {
|
||||
public String getTokenEndpointAuthSigningAlg() {
|
||||
return token_endpoint_auth_signing_alg;
|
||||
}
|
||||
|
||||
public String getScope() {
|
||||
return scope;
|
||||
}
|
||||
|
||||
public String[] getGrantTypes() {
|
||||
return grantTypes;
|
||||
}
|
||||
|
||||
public String[] getResponseTypes() {
|
||||
return responseTypes;
|
||||
}
|
||||
|
||||
public String getPolicyUri() {
|
||||
return policyUri;
|
||||
}
|
||||
|
||||
public String getJwksUri() {
|
||||
return jwksUri;
|
||||
return jwks_uri;
|
||||
}
|
||||
|
||||
public Jwks getJwks() {
|
||||
return jwks;
|
||||
}
|
||||
|
||||
public String getApplicationType() {
|
||||
return applicationType;
|
||||
}
|
||||
|
||||
public String getSectorIdentifierUri() {
|
||||
return sectorIdentifierUri;
|
||||
}
|
||||
|
||||
public String getSubjectType() {
|
||||
return subjectType;
|
||||
}
|
||||
|
||||
public String getRequestObjectSigningAlg() {
|
||||
return requestObjectSigningAlg;
|
||||
}
|
||||
|
||||
public String getUserInfoSignedResponseAlg() {
|
||||
return userInfoSignedResponseAlg;
|
||||
}
|
||||
|
||||
public String getUserInfoEncryptedResponseAlg() {
|
||||
return userInfoEncryptedResponseAlg;
|
||||
}
|
||||
|
||||
public String getUserInfoEncryptedResponseEnc() {
|
||||
return userInfoEncryptedResponseEnc;
|
||||
}
|
||||
|
||||
public String getIdTokenSignedResponseAlg() {
|
||||
return idTokenSignedResponseAlg;
|
||||
}
|
||||
|
||||
public String getIdTokenEncryptedResponseAlg() {
|
||||
return idTokenEncryptedResponseAlg;
|
||||
}
|
||||
|
||||
public String getIdTokenEncryptedResponseEnc() {
|
||||
return idTokenEncryptedResponseEnc;
|
||||
}
|
||||
|
||||
public String getTokenEndpointAuthSigningAlg() {
|
||||
return tokenEndpointAuthSigningAlg;
|
||||
}
|
||||
|
||||
public String getDefaultMaxAge() {
|
||||
return defaultMaxAge;
|
||||
}
|
||||
|
||||
public String getRequireAuthTime() {
|
||||
return requireAuthTime;
|
||||
}
|
||||
|
||||
public String[] getDefaultACRvalues() {
|
||||
return defaultACRvalues;
|
||||
}
|
||||
|
||||
public String getInitiateLoginUri() {
|
||||
return initiateLoginUri;
|
||||
}
|
||||
|
||||
public String[] getPostLogoutRedirectUris() {
|
||||
return postLogoutRedirectUris;
|
||||
}
|
||||
|
||||
public String[] getRequestUris() {
|
||||
return requestUris;
|
||||
}
|
||||
|
||||
public String[] getAuthorities() {
|
||||
return authorities;
|
||||
}
|
||||
|
||||
public int getAccessTokenValiditySeconds() {
|
||||
return accessTokenValiditySeconds;
|
||||
}
|
||||
|
||||
public int getRefreshTokenValiditySeconds() {
|
||||
return refreshTokenValiditySeconds;
|
||||
}
|
||||
|
||||
public String[] getResourceIds() {
|
||||
return resourceIds;
|
||||
}
|
||||
|
||||
public String getClientDescription() {
|
||||
return clientDescription;
|
||||
}
|
||||
|
||||
public boolean isReuseRefreshToken() {
|
||||
return reuseRefreshToken;
|
||||
}
|
||||
|
||||
public boolean isDynamicallyRegistered() {
|
||||
return dynamicallyRegistered;
|
||||
}
|
||||
|
||||
public boolean isAllowIntrospection() {
|
||||
return allowIntrospection;
|
||||
}
|
||||
|
||||
public int getIdTokenValiditySeconds() {
|
||||
return idTokenValiditySeconds;
|
||||
}
|
||||
|
||||
public String getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public boolean isClearAccessTokensOnRefresh() {
|
||||
return clearAccessTokensOnRefresh;
|
||||
}
|
||||
|
||||
public String getDeviceCodeValiditySeconds() {
|
||||
return deviceCodeValiditySeconds;
|
||||
}
|
||||
|
||||
public String[] getClaimsRedirectUris() {
|
||||
return claimsRedirectUris;
|
||||
}
|
||||
|
||||
public String getSoftwareStatement() {
|
||||
return softwareStatement;
|
||||
}
|
||||
|
||||
public String getCodeChallengeMethod() {
|
||||
return codeChallengeMethod;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,11 +31,9 @@ public class RegisteredServicesUtils {
|
|||
return false; //no harm in accessing nothing
|
||||
}
|
||||
System.out.println("....and HERE");
|
||||
System.out.println(registeredService.getAai_id());
|
||||
System.out.println(registeredService.getClientId());
|
||||
System.out.println(registeredService.getOwner());
|
||||
if (registeredService.getOwner().equals(userid)) return true;
|
||||
|
||||
return false;
|
||||
return registeredService.getOwner().equals(userid);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,12 +28,11 @@ public class TokenUtils {
|
|||
@Value("${oidc.issuer}")
|
||||
private String issuer;
|
||||
|
||||
public String registerService(String serverRequestJSON, String accessToken)
|
||||
public String registerService(String serverRequestJSON)
|
||||
throws IOException {
|
||||
|
||||
HttpPost httppost = new HttpPost( issuer + "/api/clients");
|
||||
HttpPost httppost = new HttpPost( issuer + "register");
|
||||
httppost.setHeader(HttpHeaders.CONTENT_TYPE, "application/json");
|
||||
httppost.setHeader(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken);
|
||||
StringEntity params = new StringEntity(serverRequestJSON.toString());
|
||||
httppost.setEntity(params);
|
||||
|
||||
|
@ -41,18 +40,19 @@ public class TokenUtils {
|
|||
HttpResponse httpResponse = httpclient.execute(httppost);
|
||||
|
||||
System.out.println("HTTP RESPONSE " + httpResponse.getStatusLine().getStatusCode());
|
||||
if (httpResponse.getStatusLine().getStatusCode() == 200) {
|
||||
if (httpResponse.getStatusLine().getStatusCode() == 201) {
|
||||
//logger.debug(IOUtils.toString(httpResponse.getEntity().getContent(), StandardCharsets.UTF_8.name()));
|
||||
return IOUtils.toString(httpResponse.getEntity().getContent(), StandardCharsets.UTF_8.name());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public HttpResponse updateService(String serviceId, String serviceSON, String accessToken) throws IOException {
|
||||
public HttpResponse updateService(String serviceId, String serviceSON, String registeredAccessToken) throws IOException {
|
||||
|
||||
HttpPut httpPut = new HttpPut(issuer + "/api/clients/"+serviceId);
|
||||
HttpPut httpPut = new HttpPut(issuer + "register/"+serviceId);
|
||||
httpPut.setHeader(HttpHeaders.CONTENT_TYPE, "application/json");
|
||||
httpPut.setHeader(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken);
|
||||
httpPut.setHeader(HttpHeaders.AUTHORIZATION, "Bearer " + registeredAccessToken);
|
||||
StringEntity params = new StringEntity(serviceSON.toString());
|
||||
httpPut.setEntity(params);
|
||||
|
||||
|
@ -60,21 +60,21 @@ public class TokenUtils {
|
|||
return httpclient.execute(httpPut);
|
||||
}
|
||||
|
||||
public HttpResponse deleteService(String serviceId, String accessToken) throws IOException {
|
||||
public HttpResponse deleteService(String serviceId, String registeredAccessToken) throws IOException {
|
||||
|
||||
System.out.println("DELETE " + issuer + "/api/clients/"+serviceId);
|
||||
HttpDelete httpDelete = new HttpDelete(issuer + "/api/clients/"+serviceId);
|
||||
System.out.println("DELETE " + issuer + "register/"+serviceId);
|
||||
HttpDelete httpDelete = new HttpDelete(issuer + "register/"+serviceId);
|
||||
httpDelete.setHeader(HttpHeaders.CONTENT_TYPE, "application/json");
|
||||
httpDelete.setHeader(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken);
|
||||
httpDelete.setHeader(HttpHeaders.AUTHORIZATION, "Bearer " + registeredAccessToken);
|
||||
|
||||
CloseableHttpClient httpclient = HttpClients.createDefault();
|
||||
return httpclient.execute(httpDelete);
|
||||
}
|
||||
|
||||
public ServiceResponse getRegisteredService(String serviceId, String accessToken) throws IOException {
|
||||
public ServiceResponse getRegisteredService(String serviceId, String registeredAccessToken) throws IOException {
|
||||
System.out.println("ISSUER " + issuer);
|
||||
HttpGet httpGet = new HttpGet(issuer + "/api/clients/"+ serviceId);
|
||||
httpGet.setHeader(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken);
|
||||
HttpGet httpGet = new HttpGet(issuer + "register/"+ serviceId);
|
||||
httpGet.setHeader(HttpHeaders.AUTHORIZATION, "Bearer " + registeredAccessToken);
|
||||
|
||||
CloseableHttpClient httpclient = HttpClients.createDefault();
|
||||
HttpResponse httpResponse = httpclient.execute(httpGet);
|
||||
|
@ -83,9 +83,9 @@ public class TokenUtils {
|
|||
return new Gson().fromJson(registeredService,ServiceResponse.class);
|
||||
}
|
||||
|
||||
public void viewRegisteredServices(List<String> serviceIds, String accessToken) throws IOException {
|
||||
public void viewRegisteredServices(List<String> serviceIds, String registeredAccessToken) throws IOException {
|
||||
for (String serviceId: serviceIds) {
|
||||
getRegisteredService(serviceId, accessToken);
|
||||
getRegisteredService(serviceId, registeredAccessToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<base href=".">
|
||||
<title>OpenAIRE - Activation</title>
|
||||
<script src="./js/jquery.js"></script>
|
||||
<script src="./js/uikit.js"></script>
|
||||
<script src="./js/uikit.min.js"></script>
|
||||
<script src="./js/validation.js"></script>
|
||||
<link rel="stylesheet" style="text/css" href="./css/theme.css">
|
||||
<link rel="stylesheet" style="text/css" href="./css/custom.css">
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<base href=".">
|
||||
<title>OpenAIRE - Enter new password</title>
|
||||
<script src="./js/jquery.js"></script>
|
||||
<script src="./js/uikit.js"></script>
|
||||
<script src="./js/uikit.min.js"></script>
|
||||
<script src="./js/validation.js"></script>
|
||||
<script src="./js/uikit-icons.min.js"></script>
|
||||
<link rel="stylesheet" style="text/css" href="./css/theme.css">
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<base href=".">
|
||||
<title>OpenAIRE - Register</title>
|
||||
<script src="./js/jquery.js"></script>
|
||||
<script src="./js/uikit.js"></script>
|
||||
<script src="./js/uikit.min.js"></script>
|
||||
<script src="./js/validation.js"></script>
|
||||
<script src="./js/uikit-icons-max.js"></script>
|
||||
<link rel="stylesheet" style="text/css" href="./css/theme.css">
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>OpenAIRE - Email Sent</title>
|
||||
<script src="./js/jquery.js"></script>
|
||||
<script src="./js/uikit.js"></script>
|
||||
<script src="./js/uikit.min.js"></script>
|
||||
<script src="./js/validation.js"></script>
|
||||
<link rel="stylesheet" style="text/css" href="./css/theme.css">
|
||||
<link rel="stylesheet" style="text/css" href="./css/custom.css">
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<base href=".">
|
||||
<title>OpenAIRE - Error</title>
|
||||
<script src="./js/jquery.js"></script>
|
||||
<script src="./js/uikit.js"></script>
|
||||
<script src="./js/uikit.min.js"></script>
|
||||
<script src="./js/validation.js"></script>
|
||||
<link rel="stylesheet" style="text/css" href="./css/theme.css">
|
||||
<link rel="stylesheet" style="text/css" href="./css/custom.css">
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<base href=".">
|
||||
<title>OpenAIRE - Error 404</title>
|
||||
<script src="./js/jquery.js"></script>
|
||||
<script src="./js/uikit.js"></script>
|
||||
<script src="./js/uikit.min.js"></script>
|
||||
<script src="./js/validation.js"></script>
|
||||
<link rel="stylesheet" style="text/css" href="./css/theme.css">
|
||||
<link rel="stylesheet" style="text/css" href="./css/custom.css">
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<base href=".">
|
||||
<title>OpenAIRE - Expired Verification Code</title>
|
||||
<script src="./js/jquery.js"></script>
|
||||
<script src="./js/uikit.js"></script>
|
||||
<script src="./js/uikit.min.js"></script>
|
||||
<script src="./js/validation.js"></script>
|
||||
<link rel="stylesheet" style="text/css" href="./css/theme.css">
|
||||
<link rel="stylesheet" style="text/css" href="./css/custom.css">
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>OpenAIRE - Forgot password</title>
|
||||
<script src="./js/jquery.js"></script>
|
||||
<script src="./js/uikit.js"></script>
|
||||
<script src="./js/uikit.min.js"></script>
|
||||
<link rel="stylesheet" style="text/css" href="./css/theme.css">
|
||||
<link rel="stylesheet" style="text/css" href="./css/custom.css">
|
||||
<link rel="stylesheet" style="text/css" href="./css/aai-custom.css">
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -16,7 +16,7 @@
|
|||
<base href=".">
|
||||
<title>OpenAIRE - APIs Authentication</title>
|
||||
<script src="./js/jquery.js"></script>
|
||||
<script src="./js/uikit.js"></script>
|
||||
<script src="./js/uikit.min.js"></script>
|
||||
<script src="./js/validation.js"></script>
|
||||
<script src="./js/uikit-icons-max.js"></script>
|
||||
<link rel="stylesheet" style="text/css" href="./css/theme.css">
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>OpenAIRE - Personal token</title>
|
||||
<script src="./js/jquery.js"></script>
|
||||
<script src="./js/uikit.js"></script>
|
||||
<script src="./js/uikit.min.js"></script>
|
||||
<script src="./js/uikit-icons-max.js"></script>
|
||||
<script>
|
||||
function copy(id) {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<base href=".">
|
||||
<title>OpenAIRE - Register</title>
|
||||
<script src="./js/jquery.js"></script>
|
||||
<script src="./js/uikit.js"></script>
|
||||
<script src="./js/uikit.min.js"></script>
|
||||
<script src="./js/validation.js"></script>
|
||||
<script src="./js/uikit-icons-max.js"></script>
|
||||
<link rel="stylesheet" style="text/css" href="./css/theme.css">
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<base href=".">
|
||||
<title>OpenAIRE - Register</title>
|
||||
<script src="./js/jquery.js"></script>
|
||||
<script src="./js/uikit.js"></script>
|
||||
<script src="./js/uikit.min.js"></script>
|
||||
<script src="./js/uikit-icons-max.js"></script>
|
||||
<link rel="stylesheet" style="text/css" href="./css/theme.css">
|
||||
<link rel="stylesheet" style="text/css" href="./css/custom.css">
|
||||
|
@ -85,12 +85,6 @@
|
|||
<c:remove var="first_name" scope="session"/>
|
||||
<c:remove var="first_name_error" scope="session"/>
|
||||
</div>
|
||||
<div class="uk-margin-medium-top">
|
||||
<label class="uk-form-label uk-text-bold" for="description">Description</label>
|
||||
<textarea id="description" name="description" type="textarea" placeholder="Description:"
|
||||
class="uk-textarea" rows="3">${description}</textarea>
|
||||
<c:remove var="description" scope="session"/>
|
||||
</div>
|
||||
<h4 class="uk-text-bold uk-text-center">Access</h4>
|
||||
<div class="uk-margin-medium-top">
|
||||
<label class="uk-form-label uk-text-bold">Scope</label>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>OpenAIRE - Successful registration</title>
|
||||
<script src="./js/jquery.js"></script>
|
||||
<script src="./js/uikit.js"></script>
|
||||
<script src="./js/uikit.min.js"></script>
|
||||
<script src="./js/validation.js"></script>
|
||||
<link rel="stylesheet" style="text/css" href="./css/theme.css">
|
||||
<link rel="stylesheet" style="text/css" href="./css/custom.css">
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<base href=".">
|
||||
<title>OpenAIRE - Registered services</title>
|
||||
<script src="./js/jquery.js"></script>
|
||||
<script src="./js/uikit.js"></script>
|
||||
<script src="./js/uikit.min.js"></script>
|
||||
<script src="./js/validation.js"></script>
|
||||
<script src="./js/uikit-icons-max.js"></script>
|
||||
<link rel="stylesheet" style="text/css" href="./css/theme.css">
|
||||
|
@ -99,7 +99,7 @@
|
|||
</a>
|
||||
</div>
|
||||
<div>
|
||||
<span>${services[key].clientId}</span>
|
||||
<span>${registeredService.clientId}</span>
|
||||
</div>
|
||||
<div><fmt:formatDate value="${registeredService.date}"
|
||||
pattern="dd-MM-yyyy HH:mm"/>
|
||||
|
@ -140,7 +140,6 @@
|
|||
<li id="details${registeredService.id}" hidden="hidden">
|
||||
<div class="uk-alert">
|
||||
<p><span class="uk-text-primary">Name:</span> ${services[key].clientName}</p>
|
||||
<p><span class="uk-text-primary">Description:</span> ${services[key].clientDescription}</p>
|
||||
<p><span class="uk-text-primary">Service Id:</span> ${services[key].clientId}</p>
|
||||
<p><span class="uk-text-primary">Scope:</span> openid</p>
|
||||
<p><span class="uk-text-primary">Grant type:</span> client credentials</p>
|
||||
|
@ -151,7 +150,8 @@
|
|||
<pre><code>${keys[key]}</code></pre>
|
||||
</p>
|
||||
<p><span class="uk-text-primary">Creation Date:</span>
|
||||
<fmt:parseDate value="${services[key].createdAt}" var="date" pattern="yyyy-MM-dd'T'HH:mm:ssZ" />
|
||||
<jsp:useBean id="date" class="java.util.Date"/>
|
||||
<jsp:setProperty name="date" property="time" value="${services[key].clientIdIssuedAt*1000}"/>
|
||||
<fmt:formatDate value="${date}"
|
||||
pattern="dd-MM-yyyy HH:mm"/>
|
||||
</p>
|
||||
|
@ -163,19 +163,18 @@
|
|||
</div>
|
||||
<!-- END OF CENTER SIDE -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function success() {
|
||||
if('${success}' !=='')
|
||||
UIkit.modal.confirm('${success}');
|
||||
}
|
||||
</script>
|
||||
<c:remove var="success" scope="session"/>
|
||||
|
||||
<!-- CONTENT ENDS HERE -->
|
||||
<c:import url="footer.jsp"/>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<script>
|
||||
function success() {
|
||||
if('${success}' !=='')
|
||||
UIkit.modal.alert('${success}');
|
||||
}
|
||||
</script>
|
||||
<c:remove var="success" scope="session"/>
|
||||
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<base href=".">
|
||||
<title>OpenAIRE - Username Reminder</title>
|
||||
<script src="./js/jquery.js"></script>
|
||||
<script src="./js/uikit.js"></script>
|
||||
<script src="./js/uikit.min.js"></script>
|
||||
<link rel="stylesheet" style="text/css" href="./css/theme.css">
|
||||
<link rel="stylesheet" style="text/css" href="./css/custom.css">
|
||||
<link rel="stylesheet" style="text/css" href="./css/aai-custom.css">
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<base href=".">
|
||||
<script src="./js/jquery.js"></script>
|
||||
<script src="./js/uikit.js"></script>
|
||||
<script src="./js/uikit.min.js"></script>
|
||||
<link rel="stylesheet" style="text/css" href="./css/theme.css">
|
||||
<link rel="stylesheet" style="text/css" href="./css/custom.css">
|
||||
<link rel="stylesheet" style="text/css" href="./css/aai-custom.css">
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<base href=".">
|
||||
<script src="./js/jquery.js"></script>
|
||||
<script src="./js/uikit.js"></script>
|
||||
<script src="./js/uikit.min.js"></script>
|
||||
<link rel="stylesheet" style="text/css" href="./css/theme.css">
|
||||
<link rel="stylesheet" style="text/css" href="./css/custom.css">
|
||||
<link rel="stylesheet" style="text/css" href="./css/aai-custom.css">
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<base href=".">
|
||||
<title>OpenAIRE - Reset Password</title>
|
||||
<script src="./js/jquery.js"></script>
|
||||
<script src="./js/uikit.js"></script>
|
||||
<script src="./js/uikit.min.js"></script>
|
||||
<script src="./js/validation.js"></script>
|
||||
<link rel="stylesheet" style="text/css" href="./css/theme.css">
|
||||
<link rel="stylesheet" style="text/css" href="./css/custom.css">
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>OpenAIRE - Success</title>
|
||||
<script src="./js/jquery.js"></script>
|
||||
<script src="./js/uikit.js"></script>
|
||||
<script src="./js/uikit.min.js"></script>
|
||||
<script src="./js/validation.js"></script>
|
||||
<link rel="stylesheet" style="text/css" href="./css/theme.css">
|
||||
<link rel="stylesheet" style="text/css" href="./css/custom.css">
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>OpenAIRE - Success</title>
|
||||
<script src="./js/jquery.js"></script>
|
||||
<script src="./js/uikit.js"></script>
|
||||
<script src="./js/uikit.min.js"></script>
|
||||
<script src="./js/validation.js"></script>
|
||||
<link rel="stylesheet" style="text/css" href="./css/theme.css">
|
||||
<link rel="stylesheet" style="text/css" href="./css/custom.css">
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<script src="./js/jquery.js"></script>
|
||||
<script src="./js/uikit.js"></script>
|
||||
<script src="./js/uikit.min.js"></script>
|
||||
<script src="./js/validation.js"></script>
|
||||
<link rel="stylesheet" style="text/css" href="./css/theme.css">
|
||||
<link rel="stylesheet" style="text/css" href="./css/custom.css">
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<base href=".">
|
||||
<title>OpenAIRE - Account verification</title>
|
||||
<script src="./js/jquery.js"></script>
|
||||
<script src="./js/uikit.js"></script>
|
||||
<script src="./js/uikit.min.js"></script>
|
||||
<script src="./js/validation.js"></script>
|
||||
<link rel="stylesheet" style="text/css" href="./css/theme.css">
|
||||
<link rel="stylesheet" style="text/css" href="./css/custom.css">
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<base href=".">
|
||||
<title>OpenAIRE - Email Verification</title>
|
||||
<script src="./js/jquery.js"></script>
|
||||
<script src="./js/uikit.js"></script>
|
||||
<script src="./js/uikit.min.js"></script>
|
||||
<script src="./js/validation.js"></script>
|
||||
<link rel="stylesheet" style="text/css" href="./css/theme.css">
|
||||
<link rel="stylesheet" style="text/css" href="./css/custom.css">
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<base href=".">
|
||||
<script src="./js/jquery.js"></script>
|
||||
<script src="./js/uikit.js"></script>
|
||||
<script src="./js/uikit.min.js"></script>
|
||||
<script src="./js/validation.js"></script>
|
||||
<link rel="stylesheet" style="text/css" href="./css/theme.css">
|
||||
<link rel="stylesheet" style="text/css" href="./css/custom.css">
|
||||
|
|
Loading…
Reference in New Issue