You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by pe...@apache.org on 2013/07/09 13:42:31 UTC
svn commit: r1501205 - in /chemistry/objectivecmis/trunk/ObjectiveCMIS:
Common/CMISAuthenticationProvider.h
Common/CMISStandardUntrustedSSLAuthenticationProvider.h
Common/CMISStandardUntrustedSSLAuthenticationProvider.m Utils/CMISLog.h
Author: peberlein
Date: Tue Jul 9 11:42:30 2013
New Revision: 1501205
URL: http://svn.apache.org/r1501205
Log:
added CMISStandardUntrustedSSLAuthenticationProvider to support untrusted SSL connections in test environments as suggested by Mike Hatfield @Alfresco
Added:
chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISStandardUntrustedSSLAuthenticationProvider.h
chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISStandardUntrustedSSLAuthenticationProvider.m
Modified:
chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISAuthenticationProvider.h
chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISLog.h
Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISAuthenticationProvider.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISAuthenticationProvider.h?rev=1501205&r1=1501204&r2=1501205&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISAuthenticationProvider.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISAuthenticationProvider.h Tue Jul 9 11:42:30 2013
@@ -19,7 +19,7 @@
#import <Foundation/Foundation.h>
-@protocol CMISAuthenticationProvider
+@protocol CMISAuthenticationProvider <NSObject>
/**
* Returns a set of HTTP headers (key-value pairs) that should be added to a
Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISStandardUntrustedSSLAuthenticationProvider.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISStandardUntrustedSSLAuthenticationProvider.h?rev=1501205&view=auto
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISStandardUntrustedSSLAuthenticationProvider.h (added)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISStandardUntrustedSSLAuthenticationProvider.h Tue Jul 9 11:42:30 2013
@@ -0,0 +1,24 @@
+/*
+ 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.
+ */
+
+#import "CMISStandardAuthenticationProvider.h"
+
+@interface CMISStandardUntrustedSSLAuthenticationProvider : CMISStandardAuthenticationProvider
+
+@end
Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISStandardUntrustedSSLAuthenticationProvider.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISStandardUntrustedSSLAuthenticationProvider.m?rev=1501205&view=auto
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISStandardUntrustedSSLAuthenticationProvider.m (added)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Common/CMISStandardUntrustedSSLAuthenticationProvider.m Tue Jul 9 11:42:30 2013
@@ -0,0 +1,50 @@
+/*
+ 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.
+ */
+
+#import "CMISStandardUntrustedSSLAuthenticationProvider.h"
+
+@implementation CMISStandardUntrustedSSLAuthenticationProvider
+
+- (BOOL)canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace
+{
+ if ([protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {
+ return YES;
+ } else {
+ return [super canAuthenticateAgainstProtectionSpace:protectionSpace];
+ }
+}
+
+/**
+ * NOTE: Once the TLS Session has been cached for an untrusted connection, that session will be reused
+ * by iOS (since 6.0) and willSendRequestForAuthenticationChallenge: will not be called again until the session is cleared.
+ * The session is cleared by an app restart or after around 10 minutes.
+ * See Apple Technical Q&A QA1727 http://developer.apple.com/library/ios/#qa/qa1727 for full details.
+ */
+- (void)didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
+{
+ if ((challenge.previousFailureCount == 0) &&
+ ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]))
+ {
+ [challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge];
+ } else {
+ [super didReceiveAuthenticationChallenge:challenge];
+ }
+}
+
+@end
Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISLog.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISLog.h?rev=1501205&r1=1501204&r2=1501205&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISLog.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISLog.h Tue Jul 9 11:42:30 2013
@@ -13,13 +13,10 @@
*/
/**
- * Default logging macros and log level
+ * Default logging level
*
- * The default logging writes to NSLog.
* The default logging level is Info for release builds and Debug for debug builds.
- * The recommended way to override the default is to #import this header file in your app's .pch file
- * and then redefine the CMIS_LOG_LEVEL macro to suit, e.g.
- * #undef CMIS_LOG_LEVEL
+ * This can easily be overriden in your app's .pch file, e.g.
* #define CMIS_LOG_LEVEL CMISLogLevelTrace
*/
#if !defined(CMISLogError)