Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TextGrid Authentication and Authorization
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DARIAH-DE
TextGridRep
TextGrid Authentication and Authorization
Commits
8fec87f8
Commit
8fec87f8
authored
5 years ago
by
Stefan E. Funk
Browse files
Options
Downloads
Patches
Plain Diff
Add name (real name) to UserRoleResponse
Increase CXF and JUNIT versions
parent
b124f626
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
info.textgrid.middleware.tgauth.tgextra-client-test/src/test/java/info/textgrid/middleware/tgauth/tgauthclient/TestTGAuthServiceOnline.java
+57
-62
57 additions, 62 deletions
...ddleware/tgauth/tgauthclient/TestTGAuthServiceOnline.java
pom.xml
+2
-2
2 additions, 2 deletions
pom.xml
with
59 additions
and
64 deletions
info.textgrid.middleware.tgauth.tgextra-client-test/src/test/java/info/textgrid/middleware/tgauth/tgauthclient/TestTGAuthServiceOnline.java
+
57
−
62
View file @
8fec87f8
...
...
@@ -23,9 +23,9 @@ import static org.junit.Assert.assertTrue;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.net.URL
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Properties
;
import
java.util.concurrent.ThreadFactory
;
import
javax.xml.ws.soap.SOAPFaultException
;
import
org.junit.AfterClass
;
import
org.junit.BeforeClass
;
...
...
@@ -111,8 +111,8 @@ public class TestTGAuthServiceOnline {
// **
// private static final String PROPERTIES_FILE = "tgauth.test.textgridlab-org.properties";
//
private static final String PROPERTIES_FILE = "tgauth.test.dev-textgridlab-org.properties";
private
static
final
String
PROPERTIES_FILE
=
"tgauth.test.test-textgridlab-org.properties"
;
private
static
final
String
PROPERTIES_FILE
=
"tgauth.test.dev-textgridlab-org.properties"
;
//
private static final String PROPERTIES_FILE = "tgauth.test.test-textgridlab-org.properties";
private
static
final
String
NOT_YET_IMPLEMENTED
=
"test not yet implemented!"
;
private
static
final
int
TGEXTRA_CLIENT_TIMEOUT
=
0
;
private
static
final
String
ERROR
=
"\t??ERROR: "
;
...
...
@@ -199,60 +199,6 @@ public class TestTGAuthServiceOnline {
deleteProject
();
}
// ---
@Test
public
void
argltest
()
throws
info
.
textgrid
.
namespaces
.
middleware
.
tgauth
.
AuthenticationFault
,
UnknownProjectFault
{
System
.
out
.
println
(
"--- ARGL BEGIN ---"
);
// Create getUserRole request.
GetUserRoleRequest
req
=
new
GetUserRoleRequest
();
req
.
setAuth
(
rbacSessionId
);
req
.
setLog
(
logParameter
);
req
.
setProject
(
projectId
);
System
.
out
.
println
(
"\tsession ID: "
+
req
.
getAuth
());
System
.
out
.
println
(
"\tlog parameter: "
+
req
.
getLog
());
System
.
out
.
println
(
"\tproject: "
+
req
.
getProject
());
System
.
out
.
println
(
TGAuthClientCommon
.
TABLINE
);
System
.
out
.
println
(
"--- GETUSERROLE ---"
);
GetUserRoleResponse
response
=
tgextra
.
getUserRole
(
req
);
System
.
out
.
println
(
"--- DONE ---"
);
// Assemble ePPN list.
List
<
String
>
eppns
=
new
ArrayList
<
String
>();
for
(
UserRole
role
:
response
.
getUserRole
())
{
eppns
.
add
(
role
.
getUsername
());
}
// Create getNames request and add ePPN list.
GetNamesRequest
gnreq
=
new
GetNamesRequest
();
req
.
setAuth
(
rbacSessionId
);
gnreq
.
setLog
(
logParameter
);
gnreq
.
getEPPN
().
addAll
(
eppns
);
System
.
out
.
println
(
gnreq
.
getEPPN
());
System
.
out
.
println
(
"--- GETNAMES ---"
);
GetNamesResponse
res
=
tgextra
.
getNames
(
gnreq
);
System
.
out
.
println
(
"--- DONE ---"
);
System
.
out
.
println
(
"size: "
+
res
.
getUserdetails
().
size
());
for
(
UserDetail
ud
:
res
.
getUserdetails
())
{
System
.
out
.
println
(
TGAuthClientCommon
.
TABLINE
);
System
.
out
.
println
(
ud
.
getEPPN
());
System
.
out
.
println
(
ud
.
getMail
());
System
.
out
.
println
(
ud
.
getName
());
System
.
out
.
println
(
ud
.
getOrganisation
());
}
System
.
out
.
println
(
"--- ARGL END ---"
);
}
// **
// TEST BUGS
// **
...
...
@@ -490,11 +436,15 @@ public class TestTGAuthServiceOnline {
int
userListSize
=
res
.
getUserdetails
().
size
();
// Get first (and only) entry for given ePPn.
int
theFunkCount
=
0
;
if
(
userListSize
!=
0
)
{
System
.
out
.
println
(
"\tuser details:"
);
for
(
UserDetail
det
:
res
.
getUserdetails
())
{
System
.
out
.
println
(
"\t\t"
+
det
.
getEPPN
()
+
" "
+
det
.
getMail
()
+
" "
+
det
.
getName
()
+
" "
+
det
.
getOrganisation
()
+
" "
+
det
.
isAgreesearch
()
+
" "
+
det
.
isUsersupplieddata
());
if
(
det
.
getMail
().
contains
(
getMyUserAtrributesEmail
))
{
theFunkCount
++;
}
}
}
else
{
System
.
out
.
println
(
"\tnothing found"
);
...
...
@@ -505,8 +455,8 @@ public class TestTGAuthServiceOnline {
if
(
userListSize
==
0
)
{
System
.
err
.
println
(
ERROR
+
"no users found containing "
+
trunk
+
"!"
);
assertTrue
(
false
);
}
else
if
(
userListSize
!=
4
)
{
System
.
err
.
println
(
ERROR
+
"
expecting 4 users"
+
trunk
+
"! Got only "
+
userListSize
);
}
else
if
(
theFunkCount
!=
3
)
{
System
.
err
.
println
(
ERROR
+
"
theFunkCount must be 3!"
);
assertTrue
(
false
);
}
else
{
System
.
out
.
println
(
OK
);
...
...
@@ -541,11 +491,15 @@ public class TestTGAuthServiceOnline {
int
userListSize
=
res
.
getUserdetails
().
size
();
// Get first (and only) entry for given ePPn.
int
theFunkCount
=
0
;
if
(
userListSize
!=
0
)
{
System
.
out
.
println
(
"\tuser details:"
);
for
(
UserDetail
det
:
res
.
getUserdetails
())
{
System
.
out
.
println
(
"\t\t"
+
det
.
getEPPN
()
+
" "
+
det
.
getMail
()
+
" "
+
det
.
getName
()
+
" "
+
det
.
getOrganisation
()
+
" "
+
det
.
isAgreesearch
()
+
" "
+
det
.
isUsersupplieddata
());
if
(
det
.
getMail
().
contains
(
getMyUserAtrributesEmail
))
{
theFunkCount
++;
}
}
}
else
{
System
.
out
.
println
(
"nothing found"
);
...
...
@@ -556,9 +510,10 @@ public class TestTGAuthServiceOnline {
if
(
userListSize
==
0
)
{
System
.
err
.
println
(
ERROR
+
"no users found containing "
+
usernameSearch
+
"!"
);
assertTrue
(
false
);
}
else
if
(
userListSize
!=
3
)
{
}
else
if
(
theFunkCount
!=
3
)
{
System
.
err
.
println
(
ERROR
+
"expecting 3 users"
+
usernameSearch
+
"! Got only "
+
userListSize
);
.
println
(
ERROR
+
"expecting 3 users with email "
+
getMyUserAtrributesEmail
+
"! Got "
+
theFunkCount
);
assertTrue
(
false
);
}
else
{
System
.
out
.
println
(
OK
);
...
...
@@ -856,7 +811,7 @@ public class TestTGAuthServiceOnline {
public
void
testTgextraGetUserRole
()
throws
info
.
textgrid
.
namespaces
.
middleware
.
tgauth
.
AuthenticationFault
,
UnknownProjectFault
{
System
.
out
.
println
(
"TESTING #GETUSERROLE"
);
System
.
out
.
println
(
"TESTING #GETUSERROLE
username (ePPN) only
"
);
GetUserRoleRequest
req
=
new
GetUserRoleRequest
();
req
.
setAuth
(
rbacSessionId
);
...
...
@@ -882,6 +837,46 @@ public class TestTGAuthServiceOnline {
System
.
out
.
println
(
OK
);
}
/**
* <p>
* Gets all roles a user has on the project.
* </p>
*
* @throws info.textgrid.namespaces.middleware.tgauth.AuthenticationFault
* @throws UnknownProjectFault
*/
@Test
public
void
testTgextraGetUserRoleWithREALNAME
()
throws
info
.
textgrid
.
namespaces
.
middleware
.
tgauth
.
AuthenticationFault
,
UnknownProjectFault
{
System
.
out
.
println
(
"TESTING #GETUSERROLE username (ePPN) AND name (as of tgauth version 1.10.0-SNAPSHOT)"
);
GetUserRoleRequest
req
=
new
GetUserRoleRequest
();
req
.
setAuth
(
rbacSessionId
);
req
.
setLog
(
logParameter
);
req
.
setProject
(
projectId
);
System
.
out
.
println
(
"\tsession ID: "
+
req
.
getAuth
());
System
.
out
.
println
(
"\tlog parameter: "
+
req
.
getLog
());
System
.
out
.
println
(
"\tproject: "
+
req
.
getProject
());
System
.
out
.
println
(
TGAuthClientCommon
.
TABLINE
);
GetUserRoleResponse
response
=
tgextra
.
getUserRole
(
req
);
for
(
UserRole
role
:
response
.
getUserRole
())
{
System
.
out
.
print
(
"\troles for "
+
role
.
getUsername
()
+
" ("
+
role
.
getName
()
+
"): "
);
for
(
String
r
:
role
.
getRoles
())
{
System
.
out
.
print
(
r
+
" "
);
}
System
.
out
.
println
();
}
System
.
out
.
println
(
TGAuthClientCommon
.
TABLINE
);
System
.
out
.
println
(
OK
);
}
/**
*
*/
...
...
This diff is collapsed.
Click to expand it.
pom.xml
+
2
−
2
View file @
8fec87f8
...
...
@@ -7,8 +7,8 @@
<name>
TextGrid :: TGAuth
</name>
<packaging>
pom
</packaging>
<properties>
<cxf.version>
3.
1.5
</cxf.version>
<junit.version>
4.
8.
1
</junit.version>
<cxf.version>
3.
2.8
</cxf.version>
<junit.version>
4.1
2
</junit.version>
</properties>
<repositories>
<repository>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment