Commit 61c0b948 authored by igoshin's avatar igoshin Committed by Matija Obreza
Browse files

add @PreAuthorize("hasAnyRole('VETTEDUSER','ADMINISTRATOR')")

#10515
parent 7dcc7af3
......@@ -81,15 +81,24 @@ public class OAuthManagementController extends BaseController {
return "redirect:/management/user/" + uuid + "/tokens";
}
@PreAuthorize("hasAnyRole('VETTEDUSER','ADMINISTRATOR')")
@RequestMapping("/addClient")
public String addClientEntry() {
return "/oauth/createclient";
}
@PreAuthorize("hasAnyRole('VETTEDUSER','ADMINISTRATOR')")
@RequestMapping("/createClient")
public String createClientEntry(@RequestParam("clientId") String clientId,
@RequestParam("clientSecret") String clientSecret,
@RequestParam(value = "redirectUri", required = false) String redirectUri) {
OAuthClientDetails clientDetails = createOAuthClient(clientId, clientSecret, redirectUri);
clientDetailsService.addClientDetails(clientDetails);
return "redirect:/profile";
}
private OAuthClientDetails createOAuthClient(String clientId, String clientSecret, String redirectUri) {
OAuthClientDetails clientDetails = new OAuthClientDetails();
clientDetails.setClientId(clientId);
clientDetails.setClientSecret(clientSecret);
......@@ -103,9 +112,6 @@ public class OAuthManagementController extends BaseController {
clientDetails.setRefreshTokenValiditySeconds(50 * 24 * 60 * 60);
// 7 days
clientDetails.setAccessTokenValiditySeconds(7 * 24 * 60 * 60);
clientDetailsService.addClientDetails(clientDetails);
return "redirect:/profile";
return clientDetails;
}
}
......@@ -75,7 +75,7 @@
<a href="<c:url value="/profile/${user.uuid}/send"/>" class="btn btn-default"/>Send validation email</a>
</c:if>
</security:authorize>
<security:authorize access="hasRole('ADMINISTRATOR') || (isAuthenticated() && principal.user.id == #user.id)">
<security:authorize access="hasAnyRole('VETTEDUSER','ADMINISTRATOR')">
<a href="<c:url value="/management/addClient" />" class="btn btn-default"><spring:message code="client.details.add" /></a>
</security:authorize>
<security:authorize access="hasRole('ADMINISTRATOR')">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment