Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Genesys PGR
Genesys Backend
Commits
61c0b948
Commit
61c0b948
authored
Feb 03, 2014
by
igoshin
Committed by
Matija Obreza
Feb 04, 2014
Browse files
add @PreAuthorize("hasAnyRole('VETTEDUSER','ADMINISTRATOR')")
#10515
parent
7dcc7af3
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/genesys2/server/servlet/controller/OAuthManagementController.java
View file @
61c0b948
...
...
@@ -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
;
}
}
src/main/webapp/WEB-INF/jsp/user/profile.jsp
View file @
61c0b948
...
...
@@ -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=
"has
Any
Role('
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')"
>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment