Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CHOReVOLUTION
security-filter
Commits
f30444ae
Commit
f30444ae
authored
Aug 30, 2016
by
frederic motte
Browse files
add simple test for SF generator
parent
0829d37a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Security-filter-gen/src/main/java/eu/chorevolution/transformations/sfgenerator/impl/SFGeneratorImpl.java
View file @
f30444ae
...
...
@@ -120,7 +120,8 @@ public class SFGeneratorImpl implements SFGenerator {
byte
[]
securityModel
=
Files
.
readAllBytes
(
securityPath
);
SFGenerator
cdGenerator
=
new
SFGeneratorImpl
();
SF
cd
=
cdGenerator
.
generateSecurityFilter
(
SFName
,
"SF"
,
"http://192.168.150.131:8080/SecurityTokenService/services/securitytokenservice"
,
securityModel
,
ServiceType
.
PROSUMER
);
SF
cd
=
cdGenerator
.
generateSecurityFilter
(
SFName
,
"SF"
,
"http://127.0.0.1:8080/SecurityTokenService/services/securitytokenservice"
,
securityModel
,
ServiceType
.
PROSUMER
);
FileUtils
.
writeByteArrayToFile
(
new
File
(
"."
+
File
.
separatorChar
+
SFName
+
File
.
separatorChar
+
"SecurityfilterServletProxy.war"
),
cd
.
getWar
());
}
...
...
@@ -130,7 +131,7 @@ public class SFGeneratorImpl implements SFGenerator {
byte
[]
securityModel
=
Files
.
readAllBytes
(
securityPath
);
SFGenerator
cdGenerator
=
new
SFGeneratorImpl
();
SF
cd
=
cdGenerator
.
generateSecurityFilter
(
SFName
,
"SF"
,
"http://
192.168.150.131
:8080/SecurityTokenService/services/securitytokenservice"
,
securityModel
,
ServiceType
.
PROVIDER
);
SF
cd
=
cdGenerator
.
generateSecurityFilter
(
SFName
,
"SF"
,
"http://
localhost
:8080/SecurityTokenService/services/securitytokenservice"
,
securityModel
,
ServiceType
.
PROVIDER
);
FileUtils
.
writeByteArrayToFile
(
new
File
(
"."
+
File
.
separatorChar
+
SFName
+
File
.
separatorChar
+
"SecurityfilterServletProxy.war"
),
cd
.
getWar
());
}
...
...
@@ -140,7 +141,7 @@ public class SFGeneratorImpl implements SFGenerator {
byte
[]
securityModel
=
Files
.
readAllBytes
(
securityPath
);
SFGenerator
cdGenerator
=
new
SFGeneratorImpl
();
SF
cd
=
cdGenerator
.
generateSecurityFilter
(
SFName
,
"SF"
,
"http://
192.168.150.131
:8080/SecurityTokenService/services/securitytokenservice"
,
securityModel
,
ServiceType
.
PROVIDER
);
SF
cd
=
cdGenerator
.
generateSecurityFilter
(
SFName
,
"SF"
,
"http://
localhost
:8080/SecurityTokenService/services/securitytokenservice"
,
securityModel
,
ServiceType
.
PROVIDER
);
FileUtils
.
writeByteArrayToFile
(
new
File
(
"."
+
File
.
separatorChar
+
SFName
+
File
.
separatorChar
+
"SecurityfilterServletProxy.war"
),
cd
.
getWar
());
}
...
...
Security-filter-impl/src/main/java/eu/chorevolution/UsernameTokenValidator.java
View file @
f30444ae
...
...
@@ -2,10 +2,13 @@ package eu.chorevolution;
import
java.net.MalformedURLException
;
import
java.net.URL
;
import
org.apache.cxf.interceptor.LoggingInInterceptor
;
import
org.apache.cxf.interceptor.LoggingOutInterceptor
;
import
javax.xml.bind.JAXBElement
;
import
org.apache.cxf.frontend.ClientProxy
;
import
org.apache.cxf.frontend.ClientProxyFactoryBean
;
import
org.apache.cxf.jaxrs.client.WebClient
;
import
org.apache.cxf.jaxws.JaxWsProxyFactoryBean
;
import
eu.chorevolution.configuration.SecurityPolicy
;
...
...
@@ -81,8 +84,12 @@ public class UsernameTokenValidator implements Validator {
QName
SERVICE_NAME
=
new
QName
(
"http://docs.oasis-open.org/ws-sx/ws-trust/200512/wsdl"
,
"SecurityTokenServiceImplService"
);
Service
service
=
Service
.
create
(
wsdlURL
,
SERVICE_NAME
);
SecurityTokenService
client
=
service
.
getPort
(
SecurityTokenService
.
class
);
ClientProxy
.
getClient
(
client
).
getInInterceptors
().
add
(
new
LoggingInInterceptor
());
ClientProxy
.
getClient
(
client
).
getOutInterceptors
().
add
(
new
LoggingOutInterceptor
());
logger
.
debug
(
"invoke STS webservice..."
);
RequestSecurityTokenType
request
=
new
RequestSecurityTokenType
();
...
...
Security-filter-impl/src/main/resources/logback.xml
View file @
f30444ae
...
...
@@ -7,7 +7,7 @@
<logger
name=
"eu.chorevolution"
level=
"DEBUG"
/>
<root
level=
"
ERROR
"
>
<root
level=
"
INFO
"
>
<appender-ref
ref=
"FILE"
/>
</root>
</configuration>
\ No newline at end of file
Write
Preview
Supports
Markdown
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