Skip to content
GitLab
Menu
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
bb96e523
Commit
bb96e523
authored
Nov 06, 2017
by
Matija Obreza
Browse files
Fixed bug in registration of new OAuth clients
parent
d2ca50a6
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/genesys2/server/servlet/controller/admin/OAuthManagementController.java
View file @
bb96e523
...
...
@@ -135,15 +135,13 @@ public class OAuthManagementController extends BaseController {
}
@PreAuthorize
(
"hasAnyRole('VETTEDUSER','ADMINISTRATOR')"
)
@RequestMapping
(
value
=
"/save-client"
,
method
=
RequestMethod
.
POST
,
params
=
"newClient=new"
)
public
String
createClientEntry
(
Model
model
,
@RequestParam
(
"title"
)
String
title
,
@RequestParam
(
"description"
)
String
description
,
@RequestParam
(
value
=
"redirectUris"
,
required
=
false
)
String
redirectUris
,
@RequestParam
(
name
=
"accessTokenValidity"
,
required
=
false
)
Integer
accessTokenValiditySeconds
,
@RequestParam
(
name
=
"refreshTokenValidity"
,
required
=
false
)
Integer
refreshTokenValiditySeconds
,
@RequestParam
(
name
=
"clientType"
,
required
=
false
)
String
clientType
)
{
@RequestMapping
(
value
=
"/save-client"
,
method
=
RequestMethod
.
POST
,
params
=
"action-save"
)
public
@ResponseBody
OAuthClient
createClientEntry
(
Model
model
,
@RequestBody
@JsonView
(
JsonViews
.
Protected
.
class
)
OAuthClient
client
)
{
OAuthClient
oauthClient
=
clientDetailsService
.
addClient
(
title
,
description
,
redirectUris
,
accessTokenValiditySeconds
,
refreshTokenValiditySeconds
);
OAuthClient
oauthClient
=
clientDetailsService
.
addClient
(
client
);
LOG
.
info
(
"Created OAuth client with clientId={}"
,
oauthClient
.
getClientId
());
return
"redirect:"
+
CONTROLLER_PATH
+
"/"
;
return
oauthClient
;
}
@PreAuthorize
(
"hasAnyRole('VETTEDUSER','ADMINISTRATOR')"
)
...
...
src/main/webapp/WEB-INF/jsp/admin/oauth/edit.jsp
View file @
bb96e523
...
...
@@ -8,14 +8,16 @@
</head>
<body>
<form
role=
"form"
class=
"form-horizontal validate"
action=
"
<c:url
value=
'/admin/oauth-clients/save-client'
/>
"
method=
"post"
>
<c:if
test=
"
${
clientDetails
.
id
gt
0
}
"
>
<input
type=
"hidden"
name=
"id"
value=
"${clientDetails.id}"
/>
</c:if>
<input
type=
"hidden"
name=
"version"
value=
"${clientDetails.version}"
/>
<input
type=
"hidden"
name=
"clientId"
value=
"${clientDetails.clientId}"
/>
<c:if
test=
"
${
clientDetails
==
null
}
"
>
<input
type=
"hidden"
name=
"newClient"
value=
"new"
/>
</c:if>
<c:choose>
<c:when
test=
"
${
clientDetails
.
id
gt
0
}
"
>
<input
type=
"hidden"
name=
"id"
value=
"${clientDetails.id}"
/>
<input
type=
"hidden"
name=
"version"
value=
"${clientDetails.version}"
/>
<input
type=
"hidden"
name=
"clientId"
value=
"${clientDetails.clientId}"
/>
</c:when>
<%-- <c:otherwise>
<input type="hidden" name="version" value="0"/>
</c:otherwise> --%>
</c:choose>
<div
class=
"form-group"
>
<label
for=
"clientId"
class=
"col-lg-3 col-md-4 control-label"
><spring:message
code=
"oauth-client.id"
/></label>
<div
class=
"col-lg-9 col-md-8"
>
...
...
@@ -175,7 +177,7 @@
delete
data
.
redirect
;
console
.
log
(
data
);
$
.
ajax
({
url
:
form
.
action
+
"
?action-save=1&id=
"
+
data
.
id
+
"
&version=
"
+
data
.
version
,
url
:
form
.
action
+
"
?action-save=1
"
+
(
data
.
id
===
undefined
?
""
:
"
&id=
"
+
data
.
id
+
"
&version=
"
+
data
.
version
)
,
type
:
'
POST
'
,
dataType
:
'
json
'
,
contentType
:
'
application/json; charset=utf-8
'
,
...
...
@@ -184,7 +186,7 @@
:
JSON
.
stringify
(
data
)),
success
:
function
(
response
)
{
// console.log('saved', response);
window
.
location
=
window
.
location
;
window
.
location
.
pathname
=
'
/admin/oauth-clients/
'
+
response
.
clientId
+
'
/
'
;
}
});
return
false
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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