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 dd13e82c
authored
Jan 12, 2015
by
Tuukka Kivilahti
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master' into emailTicketBarcode
2 parents
a8bf1059
c00a7b31
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
3 deletions
code/moya-beans-client/ejbModule/fi/codecrew/moya/beans/LoggingBeanLocal.java
code/moya-beans/ejbModule/fi/codecrew/moya/beans/moyamessage/MoyaEventSender.java
code/moya-parent/pom.xml
code/moya-web/src/main/java/fi/codecrew/moya/HostnameFilter.java
code/moya-beans-client/ejbModule/fi/codecrew/moya/beans/LoggingBeanLocal.java
View file @
dd13e82
...
@@ -37,4 +37,6 @@ public interface LoggingBeanLocal {
...
@@ -37,4 +37,6 @@ public interface LoggingBeanLocal {
void
sendMessage
(
MoyaEventType
type
,
EventUser
user
,
Object
...
message
);
void
sendMessage
(
MoyaEventType
type
,
EventUser
user
,
Object
...
message
);
void
sendMessage
(
MoyaEventType
type
,
Object
...
message
);
}
}
code/moya-beans/ejbModule/fi/codecrew/moya/beans/moyamessage/MoyaEventSender.java
View file @
dd13e82
...
@@ -81,4 +81,14 @@ public class MoyaEventSender implements LoggingBeanLocal {
...
@@ -81,4 +81,14 @@ public class MoyaEventSender implements LoggingBeanLocal {
}
}
@Override
public
void
sendMessage
(
MoyaEventType
type
,
Object
...
message
)
{
StringBuilder
sb
=
new
StringBuilder
();
for
(
Object
m
:
message
)
{
sb
.
append
(
m
);
}
sendMessage
(
type
,
permbean
.
getCurrentUser
(),
sb
.
toString
());
}
}
}
code/moya-parent/pom.xml
View file @
dd13e82
...
@@ -72,7 +72,7 @@
...
@@ -72,7 +72,7 @@
<dependency>
<dependency>
<groupId>
fi.iudex
</groupId>
<groupId>
fi.iudex
</groupId>
<artifactId>
utils-standalone
</artifactId>
<artifactId>
utils-standalone
</artifactId>
<version>
1.0.1
1
</version>
<version>
1.0.1
2
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
net.sf.barcode4j
</groupId>
<groupId>
net.sf.barcode4j
</groupId>
...
@@ -124,14 +124,13 @@
...
@@ -124,14 +124,13 @@
<dependency>
<dependency>
<groupId>
fi.iudex
</groupId>
<groupId>
fi.iudex
</groupId>
<artifactId>
jerklib
</artifactId>
<artifactId>
jerklib
</artifactId>
<version>
1.0.
2
</version>
<version>
1.0.
4
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
net.matlux
</groupId>
<groupId>
net.matlux
</groupId>
<artifactId>
jvm-breakglass
</artifactId>
<artifactId>
jvm-breakglass
</artifactId>
<version>
0.0.7
</version>
<version>
0.0.7
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.wordnik
</groupId>
<groupId>
com.wordnik
</groupId>
<artifactId>
swagger-annotations
</artifactId>
<artifactId>
swagger-annotations
</artifactId>
...
...
code/moya-web/src/main/java/fi/codecrew/moya/HostnameFilter.java
View file @
dd13e82
...
@@ -40,11 +40,13 @@ import org.slf4j.Logger;
...
@@ -40,11 +40,13 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.MDC
;
import
org.slf4j.MDC
;
import
fi.codecrew.moya.beans.LoggingBeanLocal
;
import
fi.codecrew.moya.beans.RestBeanLocal
;
import
fi.codecrew.moya.beans.RestBeanLocal
;
import
fi.codecrew.moya.beans.SessionMgmtBeanLocal
;
import
fi.codecrew.moya.beans.SessionMgmtBeanLocal
;
import
fi.codecrew.moya.clientutils.BortalLocalContextHolder
;
import
fi.codecrew.moya.clientutils.BortalLocalContextHolder
;
import
fi.codecrew.moya.model.User
;
import
fi.codecrew.moya.model.User
;
import
fi.codecrew.moya.rest.RestApplicationEntrypoint
;
import
fi.codecrew.moya.rest.RestApplicationEntrypoint
;
import
fi.codecrew.moya.utilities.moyamessage.MoyaEventType
;
/**
/**
* Servlet Filter implementation class HostnameFilter
* Servlet Filter implementation class HostnameFilter
...
@@ -59,6 +61,8 @@ public class HostnameFilter implements Filter {
...
@@ -59,6 +61,8 @@ public class HostnameFilter implements Filter {
@EJB
@EJB
private
RestBeanLocal
restauth
;
private
RestBeanLocal
restauth
;
@EJB
private
LoggingBeanLocal
logbean
;
@Override
@Override
public
void
init
(
FilterConfig
config
)
throws
ServletException
{
public
void
init
(
FilterConfig
config
)
throws
ServletException
{
...
@@ -279,6 +283,16 @@ public class HostnameFilter implements Filter {
...
@@ -279,6 +283,16 @@ public class HostnameFilter implements Filter {
if
(
sessionHostname
==
null
)
{
if
(
sessionHostname
==
null
)
{
session
.
setAttribute
(
SESSION_HOSTNAMESTORE
,
hostname
);
session
.
setAttribute
(
SESSION_HOSTNAMESTORE
,
hostname
);
}
else
if
(!
hostname
.
equals
(
sessionHostname
))
{
}
else
if
(!
hostname
.
equals
(
sessionHostname
))
{
Principal
principal
=
httpRequest
.
getUserPrincipal
();
String
login
=
null
;
if
(
principal
!=
null
)
{
login
=
principal
.
getName
();
}
logbean
.
sendMessage
(
MoyaEventType
.
USER_PERMISSION_VIOLATION
,
"Hostname mismatch privilege escalation! User '"
,
login
,
"' tried to change hostname from '"
,
sessionHostname
,
"' to '"
,
hostname
,
","
);
throw
new
RuntimeException
(
"Hostname mismatch!"
);
throw
new
RuntimeException
(
"Hostname mismatch!"
);
}
}
...
...
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