Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@FrankGasparovic
Copy link

No description provided.

if (adapter.getAdapterEndpoint() == null || adapter.getAdapterEndpoint().isEmpty()) {
throw new AttributeConnectorException("Attribute adapter configuration requires a nonempty endpoint URL");
}
if (!adapter.getAdapterEndpoint().startsWith("https://")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let us check for case insensitiveness for https

@FrankGasparovic FrankGasparovic force-pushed the US102589 branch 2 times, most recently from 3103b84 to 47a4f5d Compare March 28, 2017 04:11
throw new AttributeConnectorException("Attribute adapter configuration requires a nonempty endpoint URL");
}
try {
if (!new URI(adapter.getAdapterEndpoint()).getScheme().equalsIgnoreCase(HTTPS)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should replace this line (new URI(adapter.getAdapterEndpoint()).getScheme().equalsIgnoreCase(HTTPS)) with function in Utils with can be used in multiple places. Also we need to handle the case if scheme is not specified(for example if someone specifies www.abcd.com)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function will be like:
boolean isHttpsUrl(String urlStr) throws URISyntaxException{
if( (urlStr != null) && (!urlStr.isEmpty())){
URI uri = URI(urlStr);
String schemeUri = url.getScheme();
if(schemeUri == null || (schemeUri.isEmpty()))
return false;
//i dont like the name HTTPS so changing into to HTTPS_STR
return (HTTPS_STR.equals(schemeUri) == true) ? true : false)
}

return false;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point regarding missing schemes.. converted to using java.net.URL so that if a protocol isn't specified it will throw a MalformedURLException (which also means no defensive checks necessary)

@anubhavi25
Copy link
Contributor

@anubhavi25 anubhavi25 changed the title US102589: Require https for adapter endpoints and UAA urls US102589: Require HTTPS for adapter endpoints and UAA token URLs Mar 28, 2017
@anubhavi25 anubhavi25 merged commit 58de359 into develop Mar 28, 2017
@anubhavi25 anubhavi25 deleted the US102589 branch March 28, 2017 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants