-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1156 from Adyen/automation/release
Release v22.0.0-beta
- Loading branch information
Showing
394 changed files
with
11,864 additions
and
3,858 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/main/java/com/adyen/httpclient/TerminalLocalAPIHostnameVerifier.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.adyen.httpclient; | ||
|
||
import com.adyen.enums.Environment; | ||
import com.adyen.terminal.security.TerminalCommonNameValidator; | ||
|
||
import javax.net.ssl.HostnameVerifier; | ||
import javax.net.ssl.SSLPeerUnverifiedException; | ||
import javax.net.ssl.SSLSession; | ||
import java.security.cert.X509Certificate; | ||
|
||
public final class TerminalLocalAPIHostnameVerifier implements HostnameVerifier { | ||
private final Environment environment; | ||
|
||
public TerminalLocalAPIHostnameVerifier(Environment environment) { | ||
this.environment = environment; | ||
} | ||
|
||
@Override | ||
public boolean verify(String hostname, SSLSession session) { | ||
try { | ||
if (session.getPeerCertificates() != null && session.getPeerCertificates().length > 0) { | ||
// Assume the first certificate is the leaf, since chain will be ordered, according to Java documentation: | ||
// https://docs.oracle.com/javase/7/docs/api/javax/net/ssl/SSLSession.html#getPeerCertificates() | ||
X509Certificate certificate = (X509Certificate) session.getPeerCertificates()[0]; | ||
return TerminalCommonNameValidator.validateCertificate(certificate, environment); | ||
} | ||
return false; | ||
} catch (SSLPeerUnverifiedException e) { | ||
e.printStackTrace(); | ||
return false; | ||
} | ||
} | ||
} |
Oops, something went wrong.