Java Doc for HostnameVerifier.java in  » Web-Services-AXIS2 » kernal » org » apache » axis2 » transport » nhttp » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Services AXIS2 » kernal » org.apache.axis2.transport.nhttp 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.axis2.transport.nhttp.HostnameVerifier

HostnameVerifier
public interface HostnameVerifier extends javax.net.ssl.HostnameVerifier(Code)
Copied from the not-yet-commons-ssl project at http://juliusdavies.ca/commons-ssl/ As the above project is accepted into Apache and its JARs become available in the Maven 2 repos, we will have to switch to using the JARs instead

Interface for checking if a hostname matches the names stored inside the server's X.509 certificate. Correctly implements javax.net.ssl.HostnameVerifier, but that interface is not recommended. Instead we added several check() methods that take SSLSocket, or X509Certificate, or ultimately (they all end up calling this one), String. (It's easier to supply JUnit with Strings instead of mock SSLSession objects!)

Our check() methods throw exceptions if the name is invalid, whereas javax.net.ssl.HostnameVerifier just returns true/false.

We provide the HostnameVerifier.DEFAULT, HostnameVerifier.STRICT, and HostnameVerifier.ALLOW_ALL implementations. We also provide the more specialized HostnameVerifier.DEFAULT_AND_LOCALHOST, as well as HostnameVerifier.STRICT_IE6. But feel free to define your own implementations!

Inspired by Sebastian Hauer's original StrictSSLProtocolSocketFactory in the HttpClient "contrib" repository.
author:
   Julius Davies
author:
   Sebastian Hauer
since:
   8-Dec-2006


Inner Class :abstract class AbstractVerifier implements HostnameVerifier
Inner Class :class Certificates

Field Summary
final public static  HostnameVerifierALLOW_ALL
     The ALLOW_ALL HostnameVerifier essentially turns hostname verification off.
final public static  HostnameVerifierDEFAULT
     The DEFAULT HostnameVerifier works the same way as Curl and Firefox.
final public static  HostnameVerifierDEFAULT_AND_LOCALHOST
     The DEFAULT_AND_LOCALHOST HostnameVerifier works like the DEFAULT one with one additional relaxation: a host of "localhost", "localhost.localdomain", "127.0.0.1", "::1" will always pass, no matter what is in the server's certificate.
final public static  HostnameVerifierSTRICT
     The STRICT HostnameVerifier works the same way as java.net.URL in Sun Java 1.4, Sun Java 5, Sun Java 6.
final public static  HostnameVerifierSTRICT_IE6
     The STRICT_IE6 HostnameVerifier works just like the STRICT one with one minor variation: the hostname can match against any of the CN's in the server's certificate, not just the first one.


Method Summary
 voidcheck(String host, SSLSocket ssl)
    
 voidcheck(String host, X509Certificate cert)
    
 voidcheck(String host, String[] cns, String[] subjectAlts)
    
 voidcheck(String[] hosts, SSLSocket ssl)
    
 voidcheck(String[] hosts, X509Certificate cert)
    
 voidcheck(String[] hosts, String[] cns, String[] subjectAlts)
     Checks to see if the supplied hostname matches any of the supplied CNs or "DNS" Subject-Alts.
 booleanverify(String host, SSLSession session)
    

Field Detail
ALLOW_ALL
final public static HostnameVerifier ALLOW_ALL(Code)
The ALLOW_ALL HostnameVerifier essentially turns hostname verification off. This implementation is a no-op, and never throws the SSLException.



DEFAULT
final public static HostnameVerifier DEFAULT(Code)
The DEFAULT HostnameVerifier works the same way as Curl and Firefox.

The hostname must match either the first CN, or any of the subject-alts. A wildcard can occur in the CN, and in any of the subject-alts.

The only difference between DEFAULT and STRICT is that a wildcard (such as "*.foo.com") with DEFAULT matches all subdomains, including "a.b.foo.com".




DEFAULT_AND_LOCALHOST
final public static HostnameVerifier DEFAULT_AND_LOCALHOST(Code)
The DEFAULT_AND_LOCALHOST HostnameVerifier works like the DEFAULT one with one additional relaxation: a host of "localhost", "localhost.localdomain", "127.0.0.1", "::1" will always pass, no matter what is in the server's certificate.



STRICT
final public static HostnameVerifier STRICT(Code)
The STRICT HostnameVerifier works the same way as java.net.URL in Sun Java 1.4, Sun Java 5, Sun Java 6. It's also pretty close to IE6. This implementation appears to be compliant with RFC 2818 for dealing with wildcards.

The hostname must match either the first CN, or any of the subject-alts. A wildcard can occur in the CN, and in any of the subject-alts. The one divergence from IE6 is how we only check the first CN. IE6 allows a match against any of the CNs present. We decided to follow in Sun Java 1.4's footsteps and only check the first CN.

A wildcard such as "*.foo.com" matches only subdomains in the same level, for example "a.foo.com". It does not match deeper subdomains such as "a.b.foo.com".




STRICT_IE6
final public static HostnameVerifier STRICT_IE6(Code)
The STRICT_IE6 HostnameVerifier works just like the STRICT one with one minor variation: the hostname can match against any of the CN's in the server's certificate, not just the first one. This behaviour is identical to IE6's behaviour.





Method Detail
check
void check(String host, SSLSocket ssl) throws IOException(Code)



check
void check(String host, X509Certificate cert) throws SSLException(Code)



check
void check(String host, String[] cns, String[] subjectAlts) throws SSLException(Code)



check
void check(String[] hosts, SSLSocket ssl) throws IOException(Code)



check
void check(String[] hosts, X509Certificate cert) throws SSLException(Code)



check
void check(String[] hosts, String[] cns, String[] subjectAlts) throws SSLException(Code)
Checks to see if the supplied hostname matches any of the supplied CNs or "DNS" Subject-Alts. Most implementations only look at the first CN, and ignore any additional CNs. Most implementations do look at all of the "DNS" Subject-Alts. The CNs or Subject-Alts may contain wildcards according to RFC 2818.
Parameters:
  cns - CN fields, in order, as extracted from the X.509certificate.
Parameters:
  subjectAlts - Subject-Alt fields of type 2 ("DNS"), as extractedfrom the X.509 certificate.
Parameters:
  hosts - The array of hostnames to verify.
throws:
  SSLException - If verification failed.



verify
boolean verify(String host, SSLSession session)(Code)



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.