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
ecsec Public
reqesidta-prototype
client-signer
Commits
2e245108
Commit
2e245108
authored
Dec 02, 2019
by
Tobias Assmann
Browse files
make client used validate-server-cert propertie also with refresh url, set default value to true
parent
2c9e835f
Changes
2
Hide whitespace changes
Inline
Side-by-side
addons/reqesidta/src/main/java/org/openecard/addons/reqesidta/ssa/SsaSessionId.java
View file @
2e245108
...
...
@@ -13,6 +13,7 @@ package org.openecard.addons.reqesidta.ssa;
import
java.io.IOException
;
import
java.net.URI
;
import
java.net.URL
;
import
org.openecard.addons.reqesidta.ReqesidtaProperties
;
import
org.openecard.httpcore.HttpResourceException
;
import
org.openecard.httpcore.InvalidProxyException
;
import
org.openecard.httpcore.InvalidUrlException
;
...
...
@@ -33,24 +34,39 @@ public class SsaSessionId {
this
.
sessionId
=
sessionId
;
}
public
static
SsaSessionId
loadFromRefreshUrl
(
URI
refreshUri
)
throws
IOException
{
try
{
URL
refreshUrl
=
refreshUri
.
toURL
();
public
static
SsaSessionId
loadFromRefreshUrl
(
URI
refreshUri
)
throws
IOException
{
try
{
URL
refreshUrl
=
refreshUri
.
toURL
();
//check if we should validate the server`s cert
//if not, disable validation in ResourceContextLoader
ResourceContextLoader
rcl
;
if
(
ReqesidtaProperties
.
isValidateServerCert
())
{
rcl
=
new
ResourceContextLoader
()
{
@Override
public
String
getAcceptsHeader
()
{
return
"text/plain"
;
}
};
}
else
{
rcl
=
new
ResourceContextLoader
()
{
@Override
public
String
getAcceptsHeader
()
{
return
"text/plain"
;
}
@Override
public
boolean
isPKIXVerify
(){
return
false
;
}
};
}
ResourceContext
result
=
rcl
.
getStream
(
refreshUrl
);
String
sessionId
=
result
.
getData
();
ResourceContext
result
=
new
ResourceContextLoader
()
{
@Override
public
String
getAcceptsHeader
()
{
return
"text/plain"
;
return
new
SsaSessionId
(
sessionId
);
}
catch
(
IOException
|
HttpResourceException
|
InvalidUrlException
|
ValidationError
|
InvalidProxyException
ex
)
{
throw
new
IOException
(
"Failed to resolve session ID via refresh URL."
,
ex
);
}
}.
getStream
(
refreshUrl
);
String
sessionId
=
result
.
getData
();
return
new
SsaSessionId
(
sessionId
);
}
catch
(
IOException
|
HttpResourceException
|
InvalidUrlException
|
ValidationError
|
InvalidProxyException
ex
)
{
throw
new
IOException
(
"Failed to resolve session ID via refresh URL."
,
ex
);
}
}
public
String
getSessionId
()
{
return
sessionId
;
...
...
addons/reqesidta/src/main/resources/reqesidta/default.properties
View file @
2e245108
# set to true when using prod
#
validate-server-cert = false
#validate-server-cert = false
validate-server-cert
=
true
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