Changeset 654 for raptor-client


Ignore:
Timestamp:
04/07/11 17:06:35 (9 years ago)
Author:
philsmart
Message:
 
Location:
raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/registry/EventReleaseEngine.java

    r650 r654  
    4242        private AttrributeFilterEngine attributeFilterEngine; 
    4343        private ServiceEndpointClient serviceEndpointInterface; 
    44          
    45         /** The public certificates for trusted servers*/ 
    46         private String trustStoreLocation; 
    47          
    48         /** The private certificate for this client */ 
    49         private String keyStoreLocation; 
    50          
    51         /** The password for the trust store*/ 
    52         private String trustStorePassword; 
    53          
    54         /** The password for the key store */ 
    55         private String keyStorePassword; 
     44 
    5645 
    5746        /** Class logger */ 
     
    140129        } 
    141130 
    142         public void setTrustStoreLocation(String trustStoreLocation) { 
    143                 this.trustStoreLocation = trustStoreLocation; 
    144         } 
    145  
    146         public String getTrustStoreLocation() { 
    147                 return trustStoreLocation; 
    148         } 
    149  
    150         public void setKeyStoreLocation(String keyStoreLocation) { 
    151                 this.keyStoreLocation = keyStoreLocation; 
    152         } 
    153  
    154         public String getKeyStoreLocation() { 
    155                 return keyStoreLocation; 
    156         } 
    157  
    158         public void setTrustStorePassword(String trustStorePassword) { 
    159                 this.trustStorePassword = trustStorePassword; 
    160         } 
    161  
    162         public String getTrustStorePassword() { 
    163                 return trustStorePassword; 
    164         } 
    165  
    166         public void setKeyStorePassword(String keyStorePassword) { 
    167                 this.keyStorePassword = keyStorePassword; 
    168         } 
    169  
    170         public String getKeyStorePassword() { 
    171                 return keyStorePassword; 
    172         } 
    173131 
    174132} 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/remoting/client/sei/impl/CxfServiceEndpointClient.java

    r650 r654  
    5353    /** Class logger */ 
    5454    private final Logger log = LoggerFactory.getLogger(CxfServiceEndpointClient.class); 
    55      
    56     /** TLS parameters */ 
    57     private TLSClientParameters tlsParameters; 
     55 
     56    /** Raptor specific TLS parameters class, that can return cxf TLSParameters*/ 
     57    private ClientTLSParameters tlsParameters; 
    5858 
    5959    @Override 
     
    9696            httpConduit.setClient(httpClientPolicy); 
    9797 
    98            
    99             if (tlsParameters!=null) 
    100                 httpConduit.setTlsClientParameters(tlsParameters); 
     98 
     99            if (getTlsParameters()!=null) 
     100                httpConduit.setTlsClientParameters(getTlsParameters().getTlsClientParameters()); 
    101101 
    102102            log.debug("Accessing the endpoint version " + client.getVersion()); 
     
    116116 
    117117    } 
    118      
    119     private TLSClientParameters getTlsSettings(){ 
    120          TLSClientParameters tls = new TLSClientParameters(); 
    121118 
    122             tls.setDisableCNCheck(true);//disable URL and CN on cert match 
     119    /** 
     120     * @param tlsParameters the tlsParameters to set 
     121     */ 
     122    public void setTlsParameters(ClientTLSParameters tlsParameters) { 
     123        this.tlsParameters = tlsParameters; 
     124    } 
    123125 
    124             //clients private 
    125             KeyStore keyStoreKeyManager = KeyStore.getInstance("JKS"); 
    126             File keyStoreFile = new File("/Users/philsmart/Documents/Java/RaptorWorkspace/keys/raptor-ica.jks"); 
    127             keyStoreKeyManager.load(new FileInputStream(keyStoreFile),  "phil11".toCharArray()); 
    128             KeyManagerFactory keyFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); 
    129             keyFactory.init(keyStoreKeyManager, "phil11".toCharArray()); 
     126    /** 
     127     * @return the tlsParameters 
     128     */ 
     129    public ClientTLSParameters getTlsParameters() { 
     130        return tlsParameters; 
     131    } 
    130132 
    131             KeyManager[] km = keyFactory.getKeyManagers(); 
    132             tls.setKeyManagers(km); 
    133  
    134             //servers public key 
    135             KeyStore keyStore = KeyStore.getInstance("JKS"); 
    136             File truststore = new File(endpoint.getPublicKey()); 
    137             keyStore.load(new FileInputStream(truststore),  endpoint.getPublicKeyPassword().toCharArray()); 
    138             TrustManagerFactory trustFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); 
    139             trustFactory.init(keyStore); 
    140  
    141             TrustManager[] tm = trustFactory.getTrustManagers(); 
    142             tls.setTrustManagers(tm); 
    143  
    144     } 
    145133} 
Note: See TracChangeset for help on using the changeset viewer.