| <!-- |
| /*************************************************************************************************************************** |
| * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file |
| * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file |
| * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance |
| * with the License. You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an |
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| * specific language governing permissions and limitations under the License. |
| ***************************************************************************************************************************/ |
| --> |
| |
| SSL Support |
| |
| <p> |
| The simplest way to enable SSL support in the client is to use the |
| {@link oajrc.RestClientBuilder#enableLaxSSL()} method. |
| </p> |
| |
| <h5 class='figure'>Example:</h5> |
| <p class='bpcode w800'> |
| <jc>// Create a client that ignores self-signed or otherwise invalid certificates.</jc> |
| RestClient rc = RestClient.<jsm>create</jsm>().enableLaxSSL().build(); |
| </p> |
| <p> |
| A more typical scenario using default cert and hostname verification is shown here: |
| </p> |
| <p class='bpcode w800'> |
| RestClient rc = RestClient.create().enableSSL().sslProtocols(<js>"TLSv1.2"</js>).build(); |
| </p> |
| <p> |
| The following convenience methods are provided in the builder class for specifying SSL parameters: |
| </p> |
| <ul class='javatree'> |
| <li class='jc'>{@link oajrc.RestClientBuilder} |
| <ul> |
| <li class='jf'>{@link oajrc.RestClientBuilder#sslProtocols(String...) sslProtocols(String...)} |
| <li class='jf'>{@link oajrc.RestClientBuilder#cipherSuites(String...) cipherSuites(String...)} |
| <li class='jf'>{@link oajrc.RestClientBuilder#hostnameVerifier(HostnameVerifier) hostnameVerifier(HostnameVerifier)} |
| <li class='jf'>{@link oajrc.RestClientBuilder#keyManagers(KeyManager...) keyManagers(KeyManager...)} |
| <li class='jf'>{@link oajrc.RestClientBuilder#trustManagers(TrustManager...)} |
| <li class='jf'>{@link oajrc.RestClientBuilder#secureRandom(SecureRandom)} |
| </ul> |
| </ul> |
| <p> |
| SSL support can also be enabled by passing in your own connection manager using {@link oajrc.RestClientBuilder#httpClientConnectionManager(HttpClientConnectionManager)}. |
| </p> |