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
IA2
GMS
Commits
f9697fb4
Commit
f9697fb4
authored
Nov 02, 2020
by
Sonia Zorba
Browse files
Allowed JWT usage on all endpoints and refactoring
parent
e3dd2142
Pipeline
#582
passed with stages
in 31 seconds
Changes
53
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
gms-client/gms-cli/src/main/resources/application.properties
deleted
100644 → 0
View file @
e3dd2142
spring.main.banner-mode
=
off
logging.level.root
=
OFF
\ No newline at end of file
gms-client/gms-client/src/main/java/it/inaf/ia2/gms/client/call/AddMemberCall.java
View file @
f9697fb4
...
...
@@ -14,7 +14,7 @@ public class AddMemberCall extends BaseCall<GmsClient> {
public
boolean
addMember
(
String
completeGroupName
,
String
userId
)
{
String
endpoint
=
"membership"
;
String
endpoint
=
"
ws/jwt/
membership"
;
if
(
completeGroupName
!=
null
&&
!
completeGroupName
.
isBlank
())
{
endpoint
+=
"/"
+
completeGroupName
;
}
...
...
gms-client/gms-client/src/main/java/it/inaf/ia2/gms/client/call/AddPermissionCall.java
View file @
f9697fb4
...
...
@@ -16,7 +16,7 @@ public class AddPermissionCall extends BaseCall<GmsClient> {
public
String
addPermission
(
String
completeGroupName
,
String
userId
,
Permission
permission
)
{
String
endpoint
=
"permission"
;
String
endpoint
=
"
ws/jwt/
permission"
;
if
(
completeGroupName
!=
null
&&
!
completeGroupName
.
isBlank
())
{
endpoint
+=
"/"
+
completeGroupName
;
}
...
...
gms-client/gms-client/src/main/java/it/inaf/ia2/gms/client/call/CreateGroupCall.java
View file @
f9697fb4
...
...
@@ -14,7 +14,7 @@ public class CreateGroupCall extends BaseCall<GmsClient> {
public
boolean
createGroup
(
String
completeGroupName
,
boolean
leaf
)
{
HttpRequest
groupsRequest
=
client
.
newRequest
(
completeGroupName
)
HttpRequest
groupsRequest
=
client
.
newRequest
(
"ws/jwt/"
+
completeGroupName
)
.
header
(
"Accept"
,
"text/plain"
)
.
header
(
"Content-Type"
,
"application/x-www-form-urlencoded"
)
.
POST
(
BodyPublishers
.
ofString
(
"leaf="
+
leaf
))
...
...
gms-client/gms-client/src/main/java/it/inaf/ia2/gms/client/call/DeleteGroupCall.java
View file @
f9697fb4
...
...
@@ -13,7 +13,7 @@ public class DeleteGroupCall extends BaseCall<GmsClient> {
public
boolean
deleteGroup
(
String
completeGroupName
)
{
HttpRequest
groupsRequest
=
client
.
newRequest
(
completeGroupName
)
HttpRequest
groupsRequest
=
client
.
newRequest
(
"ws/jwt/"
+
completeGroupName
)
.
header
(
"Accept"
,
"text/plain"
)
.
DELETE
()
.
build
();
...
...
gms-client/gms-client/src/main/java/it/inaf/ia2/gms/client/call/GetGroupPermissionsCall.java
View file @
f9697fb4
...
...
@@ -20,7 +20,7 @@ public class GetGroupPermissionsCall extends BaseCall<GmsClient> {
List
<
GroupPermission
>
groupPermissions
=
new
ArrayList
<>();
String
endpoint
=
"permission"
;
String
endpoint
=
"
ws/jwt/
permission"
;
endpoint
+=
"/"
+
groupId
;
HttpRequest
groupsRequest
=
client
.
newRequest
(
endpoint
)
...
...
gms-client/gms-client/src/main/java/it/inaf/ia2/gms/client/call/GetUserGroupsCall.java
View file @
f9697fb4
...
...
@@ -22,7 +22,7 @@ public class GetUserGroupsCall extends BaseCall<GmsClient> {
List
<
String
>
groups
=
new
ArrayList
<>();
HttpRequest
groupsRequest
=
client
.
newRequest
(
"search"
)
HttpRequest
groupsRequest
=
client
.
newRequest
(
"
vo/
search"
)
.
header
(
"Accept"
,
"text/plain"
)
.
GET
()
.
build
();
...
...
@@ -52,7 +52,7 @@ public class GetUserGroupsCall extends BaseCall<GmsClient> {
List
<
String
>
groups
=
new
ArrayList
<>();
String
endpoint
=
"membership"
;
String
endpoint
=
"
ws/jwt/
membership"
;
if
(
prefix
!=
null
&&
!
prefix
.
isBlank
())
{
endpoint
+=
"/"
+
prefix
;
}
...
...
gms-client/gms-client/src/main/java/it/inaf/ia2/gms/client/call/GetUserPermissionsCall.java
View file @
f9697fb4
...
...
@@ -20,7 +20,7 @@ public class GetUserPermissionsCall extends BaseCall<GmsClient> {
List
<
UserPermission
>
userPermissions
=
new
ArrayList
<>();
String
endpoint
=
"permission"
;
String
endpoint
=
"
ws/jwt/
permission"
;
endpoint
+=
"?user_id="
+
userId
;
HttpRequest
groupsRequest
=
client
.
newRequest
(
endpoint
)
...
...
gms-client/gms-client/src/main/java/it/inaf/ia2/gms/client/call/ListGroupsCall.java
View file @
f9697fb4
...
...
@@ -23,7 +23,7 @@ public class ListGroupsCall extends BaseCall<GmsClient> {
List
<
String
>
groups
=
new
ArrayList
<>();
String
uri
=
"list"
;
String
uri
=
"
ws/jwt/
list"
;
if
(
prefix
!=
null
&&
!
prefix
.
isBlank
())
{
uri
+=
"/"
+
prefix
;
}
...
...
gms-client/gms-client/src/main/java/it/inaf/ia2/gms/client/call/RemoveMemberCall.java
View file @
f9697fb4
...
...
@@ -13,7 +13,7 @@ public class RemoveMemberCall extends BaseCall<GmsClient> {
public
boolean
removeMember
(
String
completeGroupName
,
String
userId
)
{
String
endpoint
=
"membership"
;
String
endpoint
=
"
ws/jwt/
membership"
;
if
(
completeGroupName
!=
null
&&
!
completeGroupName
.
isBlank
())
{
endpoint
+=
"/"
+
completeGroupName
;
}
...
...
gms-client/gms-client/src/main/java/it/inaf/ia2/gms/client/call/RemovePermissionCall.java
View file @
f9697fb4
...
...
@@ -13,7 +13,7 @@ public class RemovePermissionCall extends BaseCall<GmsClient> {
public
boolean
removePermission
(
String
completeGroupName
,
String
userId
)
{
String
endpoint
=
"permission"
;
String
endpoint
=
"
ws/jwt/
permission"
;
if
(
completeGroupName
!=
null
&&
!
completeGroupName
.
isBlank
())
{
endpoint
+=
"/"
+
completeGroupName
;
}
...
...
gms-client/gms-client/src/main/java/it/inaf/ia2/gms/client/call/SetPermissionCall.java
View file @
f9697fb4
...
...
@@ -14,7 +14,7 @@ public class SetPermissionCall extends BaseCall<GmsClient> {
public
String
setPermission
(
String
completeGroupName
,
String
userId
,
Permission
permission
)
{
String
endpoint
=
"permission"
;
String
endpoint
=
"
ws/jwt/
permission"
;
if
(
completeGroupName
!=
null
&&
!
completeGroupName
.
isBlank
())
{
endpoint
+=
"/"
+
completeGroupName
;
}
...
...
gms-client/gms-client/src/test/java/it/inaf/ia2/gms/client/call/AddMemberTest.java
View file @
f9697fb4
...
...
@@ -28,6 +28,6 @@ public class AddMemberTest extends BaseGmsClientTest {
when
(
httpClient
.
sendAsync
(
any
(),
any
())).
thenReturn
(
response
);
gmsClient
.
addMember
(
"LBT.INAF"
,
"user"
);
verify
(
httpClient
,
times
(
1
)).
sendAsync
(
endpointEq
(
"POST"
,
"membership/LBT.INAF"
),
any
());
verify
(
httpClient
,
times
(
1
)).
sendAsync
(
endpointEq
(
"POST"
,
"
ws/jwt/
membership/LBT.INAF"
),
any
());
}
}
gms-client/gms-client/src/test/java/it/inaf/ia2/gms/client/call/AddPermissionTest.java
View file @
f9697fb4
...
...
@@ -29,6 +29,6 @@ public class AddPermissionTest extends BaseGmsClientTest {
when
(
httpClient
.
sendAsync
(
any
(),
any
())).
thenReturn
(
response
);
gmsClient
.
addPermission
(
"LBT.INAF"
,
"user"
,
Permission
.
ADMIN
);
verify
(
httpClient
,
times
(
1
)).
sendAsync
(
endpointEq
(
"POST"
,
"permission/LBT.INAF"
),
any
());
verify
(
httpClient
,
times
(
1
)).
sendAsync
(
endpointEq
(
"POST"
,
"
ws/jwt/
permission/LBT.INAF"
),
any
());
}
}
gms-client/gms-client/src/test/java/it/inaf/ia2/gms/client/call/CreateGroupTest.java
View file @
f9697fb4
...
...
@@ -28,6 +28,6 @@ public class CreateGroupTest extends BaseGmsClientTest {
when
(
httpClient
.
sendAsync
(
any
(),
any
())).
thenReturn
(
response
);
gmsClient
.
createGroup
(
"LBT.INAF"
,
false
);
verify
(
httpClient
,
times
(
1
)).
sendAsync
(
endpointEq
(
"POST"
,
"LBT.INAF"
),
any
());
verify
(
httpClient
,
times
(
1
)).
sendAsync
(
endpointEq
(
"POST"
,
"
ws/jwt/
LBT.INAF"
),
any
());
}
}
gms-client/gms-client/src/test/java/it/inaf/ia2/gms/client/call/DeleteGroupTest.java
View file @
f9697fb4
...
...
@@ -28,6 +28,6 @@ public class DeleteGroupTest extends BaseGmsClientTest {
when
(
httpClient
.
sendAsync
(
any
(),
any
())).
thenReturn
(
response
);
gmsClient
.
deleteGroup
(
"LBT.INAF"
);
verify
(
httpClient
,
times
(
1
)).
sendAsync
(
endpointEq
(
"DELETE"
,
"LBT.INAF"
),
any
());
verify
(
httpClient
,
times
(
1
)).
sendAsync
(
endpointEq
(
"DELETE"
,
"
ws/jwt/
LBT.INAF"
),
any
());
}
}
gms-client/gms-client/src/test/java/it/inaf/ia2/gms/client/call/GetUserGroupsTest.java
View file @
f9697fb4
...
...
@@ -34,7 +34,7 @@ public class GetUserGroupsTest extends BaseGmsClientTest {
when
(
httpClient
.
sendAsync
(
any
(),
any
())).
thenReturn
(
response
);
List
<
String
>
groups
=
gmsClient
.
getMyGroups
(
"LBT."
);
verify
(
httpClient
,
times
(
1
)).
sendAsync
(
endpointEq
(
"GET"
,
"search"
),
any
());
verify
(
httpClient
,
times
(
1
)).
sendAsync
(
endpointEq
(
"GET"
,
"
vo/
search"
),
any
());
assertEquals
(
2
,
groups
.
size
());
assertEquals
(
"INAF"
,
groups
.
get
(
0
));
...
...
@@ -52,7 +52,7 @@ public class GetUserGroupsTest extends BaseGmsClientTest {
when
(
httpClient
.
sendAsync
(
any
(),
any
())).
thenReturn
(
response
);
List
<
String
>
groups
=
gmsClient
.
listGroups
(
"LBT."
);
verify
(
httpClient
,
times
(
1
)).
sendAsync
(
endpointEq
(
"GET"
,
"list/LBT."
),
any
());
verify
(
httpClient
,
times
(
1
)).
sendAsync
(
endpointEq
(
"GET"
,
"
ws/jwt/
list/LBT."
),
any
());
assertEquals
(
2
,
groups
.
size
());
assertEquals
(
"INAF"
,
groups
.
get
(
0
));
...
...
gms-client/gms-client/src/test/java/it/inaf/ia2/gms/client/call/RemoveMemberTest.java
View file @
f9697fb4
...
...
@@ -28,6 +28,6 @@ public class RemoveMemberTest extends BaseGmsClientTest {
when
(
httpClient
.
sendAsync
(
any
(),
any
())).
thenReturn
(
response
);
gmsClient
.
removeMember
(
"LBT.INAF"
,
"user"
);
verify
(
httpClient
,
times
(
1
)).
sendAsync
(
endpointEq
(
"DELETE"
,
"membership/LBT.INAF?user_id=user"
),
any
());
verify
(
httpClient
,
times
(
1
)).
sendAsync
(
endpointEq
(
"DELETE"
,
"
ws/jwt/
membership/LBT.INAF?user_id=user"
),
any
());
}
}
gms-client/gms-client/src/test/java/it/inaf/ia2/gms/client/call/RemovePermissionTest.java
View file @
f9697fb4
...
...
@@ -28,6 +28,6 @@ public class RemovePermissionTest extends BaseGmsClientTest {
when
(
httpClient
.
sendAsync
(
any
(),
any
())).
thenReturn
(
response
);
gmsClient
.
removePermission
(
"LBT.INAF"
,
"user"
);
verify
(
httpClient
,
times
(
1
)).
sendAsync
(
endpointEq
(
"DELETE"
,
"permission/LBT.INAF?user_id=user"
),
any
());
verify
(
httpClient
,
times
(
1
)).
sendAsync
(
endpointEq
(
"DELETE"
,
"
ws/jwt/
permission/LBT.INAF?user_id=user"
),
any
());
}
}
gms/pom.xml
View file @
f9697fb4
...
...
@@ -68,36 +68,46 @@
</dependency>
</dependencies>
<profiles>
<profile>
<id>
build-gui
</id>
<build>
<plugins>
<plugin>
<groupId>
com.github.eirslett
</groupId>
<artifactId>
frontend-maven-plugin
</artifactId>
<version>
1.7.6
</version>
<configuration>
<nodeVersion>
v12.6.0
</nodeVersion>
<environmentVariables>
<VUE_APP_SHOW_USER_ID_IN_SEARCH>
${show.user_id_in_search}
</VUE_APP_SHOW_USER_ID_IN_SEARCH>
</environmentVariables>
</configuration>
<executions>
<execution>
<goals>
<goal>
install-node-and-npm
</goal>
</goals>
</execution>
<execution>
<id>
npm install
</id>
<goals>
<goal>
npm
</goal>
</goals>
<configuration>
<arguments>
run build --prefix ../gms-ui
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<finalName>
gms
</finalName>
<plugins>
<plugin>
<groupId>
com.github.eirslett
</groupId>
<artifactId>
frontend-maven-plugin
</artifactId>
<version>
1.7.6
</version>
<configuration>
<nodeVersion>
v12.6.0
</nodeVersion>
<environmentVariables>
<VUE_APP_SHOW_USER_ID_IN_SEARCH>
${show.user_id_in_search}
</VUE_APP_SHOW_USER_ID_IN_SEARCH>
</environmentVariables>
</configuration>
<executions>
<execution>
<goals>
<goal>
install-node-and-npm
</goal>
</goals>
</execution>
<execution>
<id>
npm install
</id>
<goals>
<goal>
npm
</goal>
</goals>
<configuration>
<arguments>
run build --prefix ../gms-ui
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>
maven-resources-plugin
</artifactId>
<version>
3.1.0
</version>
...
...
Prev
1
2
3
Next
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