Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
PERFORMA_REPLICA
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Muhammad Usman
PERFORMA_REPLICA
Commits
21c12272
Commit
21c12272
authored
Jun 26, 2017
by
Harsh Shah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test SSO review changes
parent
74734ff8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
67 deletions
+41
-67
ClientAuthToken.java
cmsWebApp/src/performa/sso/ClientAuthToken.java
+0
-44
Utils.java
cmsWebApp/src/performa/utils/Utils.java
+5
-0
testsso.jsp
cmsWebApp/webroot/testsso.jsp
+36
-23
No files found.
cmsWebApp/src/performa/sso/ClientAuthToken.java
deleted
100644 → 0
View file @
74734ff8
package
performa
.
sso
;
import
oneit.objstore.*
;
import
oneit.security.AuthorisationToken
;
import
oneit.security.SecUser
;
import
oneit.utils.BaseObject
;
import
oneit.utils.Debug
;
public
class
ClientAuthToken
extends
BaseObject
implements
AuthorisationToken
{
public
static
final
String
ROLE_TL_CLIENT
=
"TL_Client"
;
SecUser
client
;
public
ClientAuthToken
(
String
userName
,
ObjectTransaction
objTran
)
{
client
=
SecUser
.
searchNAME
(
objTran
,
userName
);
Debug
.
assertion
(
client
!=
null
,
"No Client matches:"
,
userName
);
}
public
boolean
isAuthorised
(
String
priv
)
{
return
client
!=
null
&&
client
.
hasRole
(
ROLE_TL_CLIENT
);
}
public
SecUser
getLoggedInClient
()
{
return
client
;
}
@Override
public
String
getIdentification
()
{
return
client
.
getDescription
();
}
@Override
public
String
getDescription
()
{
return
""
;
}
}
cmsWebApp/src/performa/utils/Utils.java
View file @
21c12272
...
...
@@ -21,4 +21,9 @@ public class Utils
{
return
Privilege
.
searchNAME
(
transaction
,
priv
);
}
public
static
boolean
isValidClient
(
SecUser
secUser
)
{
return
(
secUser
!=
null
&&
secUser
.
hasRole
(
ROLE_CLIENT
));
}
}
cmsWebApp/webroot/testsso.jsp
View file @
21c12272
...
...
@@ -2,7 +2,7 @@
<
%@
page
import=
"oneit.security.*, oneit.servlets.security.SessionSecUserDecorator"
%
>
<
%@
page
import=
"java.util.Date"
%
>
<
%@
page
import=
"oneit.objstore.services.TransactionServicesFactory"
%
>
<
%@
page
import=
"performa.
sso
.*, oneit.objstore.*, oneit.appservices.config.*"
%
>
<
%@
page
import=
"performa.
utils
.*, oneit.objstore.*, oneit.appservices.config.*"
%
>
<
%
SecUser
pageUser =
(SecUser)(session.getAttribute(SecUser.SEC_USER_ID));
...
...
@@ -10,37 +10,50 @@
if
(
userName
!=
null
)
{
TransactionServicesFactory
tsf =
(TransactionServicesFactory)ConfigMgr.getConfigObject(ConfigMgr.GLOBAL_CONFIG_SYSTEM,
"
TransactionServices
");
ObjectTransaction
objTran =
new
ObjectTransaction
(
tsf
);
try
if
(
ConfigMgr
.
getKeyfileBoolean
("
test
.
sso
",
false
))
{
ClientAuthToken
authToken =
new
ClientAuthToken
(
userName
,
objTran
);
if
(
authToken
.
isAuthorised
(
null
))
TransactionServicesFactory
tsf =
(TransactionServicesFactory)ConfigMgr.getConfigObject(ConfigMgr.GLOBAL_CONFIG_SYSTEM,
"
TransactionServices
");
ObjectTransaction
objTran =
new
ObjectTransaction
(
tsf
);
try
{
request
.
getSession
().
invalidate
();
request
.
getSession
().
setAttribute
(
AuthorisationToken
.
AUTH_TOKEN_ID
,
authToken
);
SecUser
secUser =
SecUser.searchNAME(objTran,
userName
);
if
(
Utils
.
isValidClient
(
secUser
))
{
request
.
getSession
().
invalidate
();
request
.
getSession
().
setAttribute
(
AuthorisationToken
.
AUTH_TOKEN_ID
,
secUser
);
request
.
getSession
().
setAttribute
(
SecUser
.
SEC_USER_ID
,
authToken
.
getLoggedInClient
());
//
place
the
user
on
the
session
request
.
getSession
().
setAttribute
(
SecUser
.
SEC_USER_ID
,
secUser
);
//
This
is
only
to
help
with
the
tomcat
manager
,
so
you
can
see
which
user
belongs
to
which
session
request
.
getSession
().
setAttribute
(
SecUser
.
SEC_USER_ID
+".
desc
",
authToken
.
getDescription
());
request
.
getSession
().
setAttribute
(
SecUser
.
SEC_USER_ID
+".
loggedin
",
""+
new
Date
());
request
.
getSession
().
setAttribute
(
SessionSecUserDecorator
.
REFRESH_SECURITY
,
Boolean
.
TRUE
);
//
This
is
only
to
help
with
the
tomcat
manager
,
so
you
can
see
which
user
belongs
to
which
session
request
.
getSession
().
setAttribute
(
SecUser
.
SEC_USER_ID
+".
desc
",
secUser
.
getDescription
());
request
.
getSession
().
setAttribute
(
SecUser
.
SEC_USER_ID
+".
loggedin
",
""+
new
Date
());
request
.
getSession
().
setAttribute
(
SessionSecUserDecorator
.
REFRESH_SECURITY
,
Boolean
.
TRUE
);
objTran
.
commit
();
objTran
.
commitResources
();
objTran
.
commit
();
objTran
.
commitResources
();
response
.
sendRedirect
("
AdminPortal-Home
.
htm
");
response
.
sendRedirect
("
AdminPortal-CreateJob
.
htm
");
}
else
{
response
.
setStatus
(
404
);
return
;
}
}
finally
{
objTran
.
releaseResources
();
}
}
finally
else
{
objTran
.
releaseResources
();
}
response
.
setStatus
(
404
);
return
;
}
}
%
>
<!DOCTYPE html>
<html>
...
...
@@ -50,7 +63,7 @@
</head>
<body>
<form
method=
"POST"
>
<input
name=
"userName"
value=
""
>
<input
name=
"userName"
value=
""
required=
"required"
>
<input
type=
"submit"
name=
"Go"
value=
"Submit"
>
</form>
</body>
...
...
Write
Preview
Markdown
is supported
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