Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Antti Väyrynen
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit b5b248f9
authored
Apr 02, 2011
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Auth module permission refactor
1 parent
49b8d99e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
9 deletions
code/LanBortalAuthModule/src/fi/insomnia/bortal/BortalLoginModule.java
code/LanBortalAuthModule/src/fi/insomnia/bortal/BortalRealm.java
code/LanBortalAuthModule/src/fi/insomnia/bortal/BortalLoginModule.java
View file @
b5b248f
...
...
@@ -66,6 +66,7 @@ public class BortalLoginModule extends AppservPasswordLoginModule {
* @throws javax.security.auth.login.LoginException
*/
@Override
protected
void
authenticateUser
()
throws
LoginException
{
log
((
new
StringBuilder
()).
append
(
"CustomRealm Auth Info:_username:"
)
.
append
(
_username
)
...
...
@@ -115,12 +116,19 @@ public class BortalLoginModule extends AppservPasswordLoginModule {
}
ArrayList
<
String
>
authenticatedGroups
=
new
ArrayList
<
String
>();
for
(
int
i
=
0
;
enumeration
!=
null
&&
enumeration
.
hasMoreElements
();
i
++)
authenticatedGroups
.
add
(
enumeration
.
nextElement
());
if
(
enumeration
!=
null
)
{
while
(
enumeration
.
hasMoreElements
())
{
authenticatedGroups
.
add
(
enumeration
.
nextElement
());
}
}
// Call commitUserAuthentication with the groupNames the user belongs to
commitUserAuthentication
(
authenticatedGroups
.
toArray
(
new
String
[
0
]));
String
[]
groups
=
authenticatedGroups
.
toArray
(
new
String
[
authenticatedGroups
.
size
()]);
System
.
out
.
println
(
"groups: "
+
groups
.
length
);
for
(
String
str
:
groups
)
{
System
.
out
.
println
(
"Str "
+
str
);
}
commitUserAuthentication
(
groups
);
}
...
...
code/LanBortalAuthModule/src/fi/insomnia/bortal/BortalRealm.java
View file @
b5b248f
...
...
@@ -48,8 +48,6 @@ import com.sun.enterprise.security.auth.realm.InvalidOperationException;
import
com.sun.enterprise.security.auth.realm.NoSuchRealmException
;
import
com.sun.enterprise.security.auth.realm.NoSuchUserException
;
/**
*
* @author nithyasubramanian SampleRealm - class extending AppservRealm Sample
...
...
@@ -58,7 +56,8 @@ import com.sun.enterprise.security.auth.realm.NoSuchUserException;
public
class
BortalRealm
extends
AppservRealm
{
// private static final Logger logger = LoggerFactory.getLogger(BortalRealm.class);
// private static final Logger logger =
// LoggerFactory.getLogger(BortalRealm.class);
private
static
final
String
JAAS_BEAN_JNDI
=
"java:global/LanBortal/LanBortalBeans/JaasBean!fi.insomnia.bortal.beans.JaasBeanRemote"
;
...
...
@@ -71,22 +70,24 @@ public class BortalRealm extends AppservRealm {
* @throws com.sun.enterprise.security.auth.realm.BadRealmException
* @throws com.sun.enterprise.security.auth.realm.NoSuchRealmException
*/
@Override
public
void
init
(
Properties
properties
)
throws
BadRealmException
,
NoSuchRealmException
{
super
.
init
(
properties
);
log
(
"Init BortalRealm"
);
String
propJaasContext
=
properties
.
getProperty
(
JAAS_CONTEXT_PARAM
);
if
(
propJaasContext
!=
null
)
{
setProperty
(
JAAS_CONTEXT_PARAM
,
propJaasContext
);
}
}
/**
*
* @return authType
*/
@Override
public
String
getAuthType
()
{
return
"Omnia Lan system authentication Realm"
;
}
...
...
@@ -98,6 +99,7 @@ public class BortalRealm extends AppservRealm {
* @throws com.sun.enterprise.security.auth.realm.InvalidOperationException
* @throws com.sun.enterprise.security.auth.realm.NoSuchUserException
*/
@Override
public
Enumeration
<
String
>
getGroupNames
(
String
user
)
throws
InvalidOperationException
,
NoSuchUserException
{
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment