Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Codecrew
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
30
Merge Requests
2
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit c19a512d
authored
Mar 21, 2010
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of dev.intra.insomnia.fi:/data/bortal
2 parents
0c8cf862
9a4f2c3a
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
34 additions
and
14 deletions
code/LanBortal/.settings/org.eclipse.wst.common.component
code/LanBortalDatabase/.project
code/LanBortalDatabase/src/fi/insomnia/bortal/model/User.java
code/LanBortalUtilities/src/META-INF/MANIFEST.MF
code/LanBortalUtilities/src/fi/insomnia/bortal/utilities/PasswordFunctions.java
code/LanBortalWeb/WebContent/resources/tools/role/form.xhtml
code/LanBortalWeb/src/fi/insomnia/bortal/view/RoleView.java
code/LanBortal/.settings/org.eclipse.wst.common.component
View file @
c19a512
...
...
@@ -13,7 +13,7 @@
<dependent-module
archiveName=
"LanBortalBeansClient.jar"
deploy-path=
"/lib"
handle=
"module:/resource/LanBortalBeansClient/LanBortalBeansClient"
>
<dependency-type>
uses
</dependency-type>
</dependent-module>
<dependent-module
archiveName=
"LanBortalUtilities.jar"
deploy-path=
"/"
handle=
"module:/resource/LanBortalUtilities/LanBortalUtilities"
>
<dependent-module
archiveName=
"LanBortalUtilities.jar"
deploy-path=
"/
lib
"
handle=
"module:/resource/LanBortalUtilities/LanBortalUtilities"
>
<dependency-type>
uses
</dependency-type>
</dependent-module>
</wb-module>
...
...
code/LanBortalDatabase/.project
View file @
c19a512
...
...
@@ -3,6 +3,7 @@
<name>
LanBortalDatabase
</name>
<comment></comment>
<projects>
<project>
LanBortalUtilities
</project>
</projects>
<buildSpec>
<buildCommand>
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/User.java
View file @
c19a512
...
...
@@ -20,8 +20,14 @@ import javax.persistence.OneToMany;
import
javax.persistence.Table
;
import
javax.persistence.Temporal
;
import
javax.persistence.TemporalType
;
import
javax.persistence.Transient
;
import
javax.persistence.Version
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
sun.reflect.generics.reflectiveObjects.NotImplementedException
;
/**
*
*/
...
...
@@ -159,6 +165,9 @@ public class User implements ModelInterface<Integer> {
@OneToMany
(
mappedBy
=
"admin"
)
private
List
<
EventSettings
>
eventSettings
;
@Transient
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
User
.
class
);
public
User
()
{
}
...
...
@@ -200,10 +209,12 @@ public class User implements ModelInterface<Integer> {
}
public
String
getPassword
()
{
logger
.
warn
(
"Directly reading raw User password"
);
return
password
;
}
public
void
setPassword
(
String
password
)
{
logger
.
warn
(
"Directly settings raw User password"
);
this
.
password
=
password
;
}
...
...
@@ -522,5 +533,12 @@ public class User implements ModelInterface<Integer> {
this
.
eventSettings
=
eventSettings
;
}
public
void
resetPassword
(
String
password
)
{
// XXX: Couldn't reference utility project
throw
new
NotImplementedException
();
}
public
boolean
checkPassword
(
String
password
)
{
throw
new
NotImplementedException
();
}
}
code/LanBortalUtilities/src/META-INF/MANIFEST.MF
View file @
c19a512
Manifest-Version: 1.0
Class-Path:
Class-Path:
lib/slf4j-api-1.5.8.jar
code/LanBortalUtilities/src/fi/insomnia/bortal/utilities/PasswordFunctions.java
View file @
c19a512
...
...
@@ -16,7 +16,8 @@ public class PasswordFunctions {
private
static
BASE64Decoder
decoder
=
new
BASE64Decoder
();
private
static
BASE64Encoder
encoder
=
new
BASE64Encoder
();
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
PasswordFunctions
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
PasswordFunctions
.
class
);
public
static
String
getEncryptedPassword
(
String
password
)
{
String
salt
=
generateSalt
();
...
...
@@ -40,7 +41,8 @@ public class PasswordFunctions {
return
base64Str
;
}
public
static
boolean
checkPlainPassword
(
String
plainPassword
,
String
saltedPassword
)
{
public
static
boolean
checkPlainPassword
(
String
plainPassword
,
String
saltedPassword
)
{
String
oldBase64
=
saltedPassword
.
substring
(
"{SSHA}"
.
length
());
String
decodedHashedAndSalt
;
...
...
@@ -51,9 +53,9 @@ public class PasswordFunctions {
return
false
;
}
String
salt
=
decodedHashedAndSalt
.
substring
(
decodedHashedAndSalt
.
length
()
-
getSaltLenght
(),
decodedHashedAndSalt
.
length
());
String
salt
=
decodedHashedAndSalt
.
substring
(
decodedHashedAndSalt
.
length
()
-
getSaltLenght
(),
decodedHashedAndSalt
.
length
());
String
newBase64
=
shaWithSaltToBase64
(
plainPassword
,
salt
);
...
...
code/LanBortalWeb/WebContent/resources/tools/role/form.xhtml
View file @
c19a512
...
...
@@ -15,7 +15,9 @@
<h:panelGrid>
<h:outputText
value=
"#{i18n['role.name']}"
/><h:inputText
value=
"#{roleView.role.name}"
/>
<h:selectManyListbox
value=
"#{roleView.possibleParents}"
/>
<h:selectManyListbox
value=
"#{roleView.role.parents}"
>
<f:selectItems
value=
"#{roleView.possibleParents}"
/>
</h:selectManyListbox>
</h:panelGrid>
</ui:composition>
</html>
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/view/RoleView.java
View file @
c19a512
...
...
@@ -9,6 +9,7 @@ import fi.insomnia.bortal.beans.SecurityBeanLocal;
import
fi.insomnia.bortal.exceptions.PermissionDeniedException
;
import
fi.insomnia.bortal.handler.SessionHandler
;
import
fi.insomnia.bortal.model.Role
;
import
java.util.List
;
import
javax.ejb.EJB
;
import
javax.faces.bean.ManagedBean
;
import
javax.faces.bean.ManagedProperty
;
...
...
@@ -38,8 +39,6 @@ public class RoleView {
private
Role
role
=
new
Role
();
DataModel
<
Role
>
items
;
private
DataModel
<
Role
>
possibleParents
;
public
DataModel
<
Role
>
getRoles
()
{
items
=
new
ListDataModel
<
Role
>(
roleBean
.
listRoles
());
logger
.
info
(
"Fetching roles. Found {}"
,
items
.
getRowCount
());
...
...
@@ -113,9 +112,7 @@ public class RoleView {
/**
* @return the possibleParents
*/
public
DataModel
<
Role
>
getPossibleParents
()
{
possibleParents
=
new
ListDataModel
<
Role
>(
roleBean
.
getPossibleParents
(
role
));
return
possibleParents
;
public
List
<
Role
>
getPossibleParents
()
{
return
roleBean
.
getPossibleParents
(
role
);
}
}
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