Return-Path: X-Original-To: apmail-chemistry-commits-archive@www.apache.org Delivered-To: apmail-chemistry-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3FC9417886 for ; Mon, 6 Apr 2015 17:11:45 +0000 (UTC) Received: (qmail 27290 invoked by uid 500); 6 Apr 2015 17:11:45 -0000 Delivered-To: apmail-chemistry-commits-archive@chemistry.apache.org Received: (qmail 27182 invoked by uid 500); 6 Apr 2015 17:11:45 -0000 Mailing-List: contact commits-help@chemistry.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@chemistry.apache.org Delivered-To: mailing list commits@chemistry.apache.org Received: (qmail 24921 invoked by uid 99); 6 Apr 2015 17:11:43 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Apr 2015 17:11:43 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id 14AE7AC0E2D for ; Mon, 6 Apr 2015 17:11:43 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r946528 [16/46] - in /websites/staging/chemistry/trunk/content: ./ java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/ java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/css/ java/0.13... Date: Mon, 06 Apr 2015 17:11:39 -0000 To: commits@chemistry.apache.org From: buildbot@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150406171143.14AE7AC0E2D@hades.apache.org> Added: websites/staging/chemistry/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref/org/apache/chemistry/opencmis/client/bindings/spi/CmisSpi.html ============================================================================== --- websites/staging/chemistry/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref/org/apache/chemistry/opencmis/client/bindings/spi/CmisSpi.html (added) +++ websites/staging/chemistry/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref/org/apache/chemistry/opencmis/client/bindings/spi/CmisSpi.html Mon Apr 6 17:11:37 2015 @@ -0,0 +1,112 @@ + + + + +CmisSpi xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.client.bindings.spi;
+20  
+21  import org.apache.chemistry.opencmis.commons.spi.AclService;
+22  import org.apache.chemistry.opencmis.commons.spi.DiscoveryService;
+23  import org.apache.chemistry.opencmis.commons.spi.MultiFilingService;
+24  import org.apache.chemistry.opencmis.commons.spi.NavigationService;
+25  import org.apache.chemistry.opencmis.commons.spi.ObjectService;
+26  import org.apache.chemistry.opencmis.commons.spi.PolicyService;
+27  import org.apache.chemistry.opencmis.commons.spi.RelationshipService;
+28  import org.apache.chemistry.opencmis.commons.spi.RepositoryService;
+29  import org.apache.chemistry.opencmis.commons.spi.VersioningService;
+30  
+31  /**
+32   * CMIS SPI interface.
+33   */
+34  public interface CmisSpi {
+35      /**
+36       * Gets a Repository Service interface object.
+37       */
+38      RepositoryService getRepositoryService();
+39  
+40      /**
+41       * Gets a Navigation Service interface object.
+42       */
+43      NavigationService getNavigationService();
+44  
+45      /**
+46       * Gets an Object Service interface object.
+47       */
+48      ObjectService getObjectService();
+49  
+50      /**
+51       * Gets a Versioning Service interface object.
+52       */
+53      VersioningService getVersioningService();
+54  
+55      /**
+56       * Gets a Relationship Service interface object.
+57       */
+58      RelationshipService getRelationshipService();
+59  
+60      /**
+61       * Gets a Discovery Service interface object.
+62       */
+63      DiscoveryService getDiscoveryService();
+64  
+65      /**
+66       * Gets a Multifiling Service interface object.
+67       */
+68      MultiFilingService getMultiFilingService();
+69  
+70      /**
+71       * Gets an ACL Service interface object.
+72       */
+73      AclService getAclService();
+74  
+75      /**
+76       * Gets a Policy Service interface object.
+77       */
+78      PolicyService getPolicyService();
+79  
+80      /**
+81       * Clears all caches of the current session.
+82       */
+83      void clearAllCaches();
+84  
+85      /**
+86       * Clears all caches of the current session that are related to the given
+87       * repository.
+88       * 
+89       * @param repositoryId
+90       *            the repository id
+91       */
+92      void clearRepositoryCache(String repositoryId);
+93  
+94      /**
+95       * Releases all resources assigned to this SPI instance.
+96       */
+97      void close();
+98  }
+
+
+ + Added: websites/staging/chemistry/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref/org/apache/chemistry/opencmis/client/bindings/spi/LTPAWSSecurityAuthenticationProvider.html ============================================================================== --- websites/staging/chemistry/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref/org/apache/chemistry/opencmis/client/bindings/spi/LTPAWSSecurityAuthenticationProvider.html (added) +++ websites/staging/chemistry/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref/org/apache/chemistry/opencmis/client/bindings/spi/LTPAWSSecurityAuthenticationProvider.html Mon Apr 6 17:11:37 2015 @@ -0,0 +1,168 @@ + + + + +LTPAWSSecurityAuthenticationProvider xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.client.bindings.spi;
+20  
+21  import java.lang.reflect.InvocationTargetException;
+22  import java.lang.reflect.Method;
+23  import java.text.SimpleDateFormat;
+24  import java.util.Set;
+25  import java.util.TimeZone;
+26  
+27  import javax.security.auth.Subject;
+28  import javax.xml.parsers.ParserConfigurationException;
+29  
+30  import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
+31  import org.apache.chemistry.opencmis.commons.impl.Base64;
+32  import org.apache.chemistry.opencmis.commons.impl.ClassLoaderUtil;
+33  import org.apache.chemistry.opencmis.commons.impl.XMLUtils;
+34  import org.slf4j.Logger;
+35  import org.slf4j.LoggerFactory;
+36  import org.w3c.dom.Document;
+37  import org.w3c.dom.Element;
+38  
+39  public class LTPAWSSecurityAuthenticationProvider extends StandardAuthenticationProvider {
+40  
+41      private static final long serialVersionUID = 1L;
+42  
+43      private static final Logger LOG = LoggerFactory.getLogger(LTPAWSSecurityAuthenticationProvider.class);
+44  
+45      @Override
+46      public Element getSOAPHeaders(Object portObject) {
+47  
+48          String securityToken = getSecurityToken();
+49  
+50          // Exit if no security token found
+51          if (securityToken == null) {
+52              if (LOG.isDebugEnabled()) {
+53                  LOG.debug("securityToken is null");
+54              }
+55              return null;
+56          }
+57  
+58          // Set time
+59          SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
+60          sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
+61          long created = System.currentTimeMillis();
+62          long expires = created + 24 * 60 * 60 * 1000; // 24 hours
+63  
+64          // Create the SOAP WSSecurity header
+65          try {
+66              Document document = XMLUtils.newDomDocument();
+67  
+68              Element wsseSecurityElement = document.createElementNS(WSSE_NAMESPACE, "Security");
+69  
+70              Element wsuTimestampElement = document.createElementNS(WSU_NAMESPACE, "Timestamp");
+71              wsseSecurityElement.appendChild(wsuTimestampElement);
+72  
+73              Element tsCreatedElement = document.createElementNS(WSU_NAMESPACE, "Created");
+74              tsCreatedElement.appendChild(document.createTextNode(sdf.format(created)));
+75              wsuTimestampElement.appendChild(tsCreatedElement);
+76  
+77              Element tsExpiresElement = document.createElementNS(WSU_NAMESPACE, "Expires");
+78              tsExpiresElement.appendChild(document.createTextNode(sdf.format(expires)));
+79              wsuTimestampElement.appendChild(tsExpiresElement);
+80  
+81              // Add the BinarySecurityToken (contains the LTPAv2 token)
+82              Element wsseBinarySecurityTokenElement = document.createElementNS(WSSE_NAMESPACE, "BinarySecurityToken");
+83              wsseBinarySecurityTokenElement.setAttribute("xmlns:wsu", WSU_NAMESPACE);
+84              wsseBinarySecurityTokenElement.setAttribute("xmlns:wsst",
+85                      "http://www.ibm.com/websphere/appserver/tokentype");
+86              wsseBinarySecurityTokenElement.setAttribute("wsu:Id", "ltpa_20");
+87              wsseBinarySecurityTokenElement.setAttribute("ValueType", "wsst:LTPAv2");
+88              wsseBinarySecurityTokenElement.appendChild(document.createTextNode(securityToken));
+89  
+90              // Append BinarySecurityToken to Security section
+91              wsseSecurityElement.appendChild(wsseBinarySecurityTokenElement);
+92  
+93              return wsseSecurityElement;
+94          } catch (ParserConfigurationException e) {
+95              // shouldn't happen...
+96              throw new CmisRuntimeException("Could not build SOAP header: " + e.getMessage(), e);
+97          }
+98      }
+99  
+100     private String getSecurityToken() {
+101         try {
+102             Class<?> wsSubjectClass = ClassLoaderUtil.loadClass("com.ibm.websphere.security.auth.WSSubject");
+103             Class<?> wsCredentialClass = ClassLoaderUtil.loadClass("com.ibm.websphere.security.cred.WSCredential");
+104 
+105             // Get current security subject
+106             Method m = wsSubjectClass.getMethod("getRunAsSubject", new Class[0]);
+107             Subject securitySubject = (Subject) m.invoke(null, new Object[0]);
+108             if (securitySubject != null) {
+109                 // Get all security credentials from the security subject
+110                 Set<?> securityCredentials = securitySubject.getPublicCredentials(wsCredentialClass);
+111 
+112                 // Get the first credential
+113                 Object securityCredential = securityCredentials.iterator().next();
+114                 String user = invokeSecurityCredentialMethod(wsCredentialClass, securityCredential, "getSecurityName");
+115 
+116                 if (user.equalsIgnoreCase("UNAUTHENTICATED")) {
+117                     if (LOG.isDebugEnabled()) {
+118                         LOG.debug("User = UNAUTHENTICATED");
+119                     }
+120                     return null;
+121                 }
+122 
+123                 byte[] token = invokeSecurityCredentialMethod(wsCredentialClass, securityCredential,
+124                         "getCredentialToken");
+125                 if (token == null) {
+126                     return null;
+127                 }
+128 
+129                 return Base64.encodeBytes(token);
+130             }
+131         } catch (Exception e) {
+132             throw new CmisRuntimeException("Could not build SOAP header: " + e.getMessage(), e);
+133         }
+134 
+135         return null;
+136     }
+137 
+138     @SuppressWarnings("unchecked")
+139     private <T> T invokeSecurityCredentialMethod(Class<?> credentialClass, Object securityCredential, String methodName)
+140             throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+141         Method m = credentialClass.getMethod(methodName, new Class[0]);
+142         return (T) m.invoke(securityCredential, new Object[0]);
+143     }
+144 
+145     @Override
+146     protected boolean getSendBasicAuth() {
+147         return false;
+148     }
+149 
+150     @Override
+151     protected boolean getSendUsernameToken() {
+152         return false;
+153     }
+154 }
+
+
+ + Added: websites/staging/chemistry/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref/org/apache/chemistry/opencmis/client/bindings/spi/LinkAccess.html ============================================================================== --- websites/staging/chemistry/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref/org/apache/chemistry/opencmis/client/bindings/spi/LinkAccess.html (added) +++ websites/staging/chemistry/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref/org/apache/chemistry/opencmis/client/bindings/spi/LinkAccess.html Mon Apr 6 17:11:37 2015 @@ -0,0 +1,58 @@ + + + + +LinkAccess xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.client.bindings.spi;
+20  
+21  /**
+22   * Provides access to internal links. It bypasses the CMIS domain model. Use
+23   * with care!
+24   */
+25  public interface LinkAccess {
+26  
+27      /**
+28       * Gets a link from the cache if it is there or loads it into the cache if
+29       * it is not there.
+30       */
+31      String loadLink(String repositoryId, String objectId, String rel, String type);
+32  
+33      /**
+34       * Gets the content link from the cache if it is there or loads it into the
+35       * cache if it is not there.
+36       */
+37      String loadContentLink(String repositoryId, String documentId);
+38  
+39      /**
+40       * Gets a rendition content link from the cache if it is there or loads it
+41       * into the cache if it is not there.
+42       */
+43      String loadRenditionContentLink(String repositoryId, String documentId, String streamId);
+44  }
+
+
+ + Added: websites/staging/chemistry/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref/org/apache/chemistry/opencmis/client/bindings/spi/NTLMAuthenticationProvider.html ============================================================================== --- websites/staging/chemistry/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref/org/apache/chemistry/opencmis/client/bindings/spi/NTLMAuthenticationProvider.html (added) +++ websites/staging/chemistry/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-bindings/xref/org/apache/chemistry/opencmis/client/bindings/spi/NTLMAuthenticationProvider.html Mon Apr 6 17:11:37 2015 @@ -0,0 +1,120 @@ + + + + +NTLMAuthenticationProvider xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.client.bindings.spi;
+20  
+21  import java.net.Authenticator;
+22  import java.net.PasswordAuthentication;
+23  import java.util.List;
+24  import java.util.Map;
+25  
+26  import org.w3c.dom.Element;
+27  
+28  /**
+29   * NTLM authentication provider class. USE WITH CARE!
+30   * 
+31   * This authentication provider sets a {@link java.net.Authenticator} which will
+32   * replace the current authenticator, if any. It will fail if this authenticator
+33   * will be replaced by another part of the code.
+34   * 
+35   * Since {@link java.net.Authenticator} is a system-wide authenticator, it will
+36   * not reliably work in multi-user environments! To achieve that you have to
+37   * wrap OpenCMIS into its own class loader.
+38   */
+39  public class NTLMAuthenticationProvider extends AbstractAuthenticationProvider {
+40  
+41      private static final long serialVersionUID = 1L;
+42  
+43      // java.net.Authenticator is static, so this can be static too
+44      private static final OpenCMISAuthenticator AUTHENTICATOR = new OpenCMISAuthenticator();
+45      static {
+46          Authenticator.setDefault(AUTHENTICATOR);
+47      }
+48  
+49      @Override
+50      public Map<String, List<String>> getHTTPHeaders(String url) {
+51          // get user and password
+52          String user = getUser();
+53          String password = getPassword();
+54  
+55          // if no user is set, reset the authenticator
+56          if (user == null) {
+57              AUTHENTICATOR.reset();
+58              return null;
+59          }
+60  
+61          if (password == null) {
+62              password = "";
+63          }
+64  
+65          // set user and password
+66          AUTHENTICATOR.setPasswordAuthentication(user, password);
+67  
+68          // OpenCMIS is not in charge of the authentication
+69          // -> no HTTP header to set
+70          return null;
+71      }
+72  
+73      @Override
+74      public Element getSOAPHeaders(Object portObject) {
+75          // no SOAP headers to set
+76          return null;
+77      }
+78  
+79      /**
+80       * OpenCMIS Authenticator class.
+81       */
+82      static class OpenCMISAuthenticator extends Authenticator {
+83  
+84          private PasswordAuthentication passwordAuthentication;
+85  
+86          /**
+87           * Resets the user and password. The next request will not be
+88           * authenticated.
+89           */
+90          public synchronized void reset() {
+91              passwordAuthentication = null;
+92          }
+93  
+94          /**
+95           * Sets a new user and password.
+96           */
+97          public synchronized void setPasswordAuthentication(String user, String password) {
+98              passwordAuthentication = new PasswordAuthentication(user, password.toCharArray());
+99          }
+100 
+101         @Override
+102         protected synchronized PasswordAuthentication getPasswordAuthentication() {
+103             return passwordAuthentication;
+104         }
+105     }
+106 }
+
+
+ +