0
A
答えて
0
現在、RestKitはNTML認証をサポートしていない、しかし、そのための回避策があります:ログインページで 1、認証と登録認証デリゲートを要求したURLをロードするためにNSURLRequestを使用しています。
- (void) connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
{
if ([[challenge protectionSpace] authenticationMethod] == NSURLAuthenticationMethodNTLM)
{
/* This is very, very important to check. Depending on how your security policies are setup, you could lock your user out of his or her account by trying to use the wrong credentials too many times in a row. */
if ([challenge previousFailureCount] > 0)
{
[[challenge sender] cancelAuthenticationChallenge:challenge];
UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Invalid Credentials" message:@"The credentials you saved for your account are invalid." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
}
else
{
[[challenge sender] useCredential:[NSURLCredential credentialWithUser:@"someUser" password:@"somePassword" persistence:NSURLCredentialPersistenceForSession] forAuthenticationChallenge:challenge];
}
}
else
{
// Do whatever you want here, for educational purposes, I'm just going to cancel the challenge
[[challenge sender] cancelAuthenticationChallenge:challenge];
}
}
他のページでは、通常、認証なしでRestKitを使用することができます。それはクッキーで認証を続けるので、私はちょうどそれが他の人と連携していないことを確認、SharePointサーバーでそれをテストします。
楽しくお楽しみください! :)
0
私はRKObjectManagerをサブクラス化し、getObjectsAtPath:
- (void)getObjectsAtPath:(NSString *)path
parameters:(NSDictionary *)parameters
success:(void (^)(RKObjectRequestOperation *operation, RKMappingResult *mappingResult))success
failure:(void (^)(RKObjectRequestOperation *operation, NSError *error))failure
{
NSParameterAssert(path);
RKObjectRequestOperation *operation = [self appropriateObjectRequestOperationWithObject:nil method:RKRequestMethodGET path:path parameters:parameters];
[operation setCompletionBlockWithSuccess:success failure:failure];
//this is the part to handle ntlm authentication, which we arent able to do in RKObjectManager
[[operation HTTPRequestOperation] setAuthenticationChallengeBlock:^(NSURLConnection *connection, NSURLAuthenticationChallenge *challenge) {
NSURLCredential *credential = [NSURLCredential credentialWithUser:@"username" password:@"password" persistence:NSURLCredentialPersistenceForSession];
[[challenge sender] useCredential:credential forAuthenticationChallenge:challenge];
}];
[self enqueueObjectRequestOperation:operation];
}
を上書きしなければなりませんでした
関連する問題
- 1. 、XHTML <a href="http://validator.w3.org/" rel="nofollow noreferrer">this</a>によると
- 2. <a href="http://www.exampleSite.com/aPage.php" rel="nofollow">http://www.exampleSite.com/aPage.php</a>に正しく
- 3. <a href="http://codeforces.com/contest/659/problem/B" rel="nofollow">Problem</a>の配列
- 4. 城ウィンザー:<a href="http://mef.codeplex.com/" rel="nofollow">MEF</a>では既存のオブジェクト
- 5. <a href="http://www.sislands.com/coin70/week6/encoder.htm" rel="nofollow">this</a>ページ内のURLパーセントエンコーディング
- 6. Tabキーは、私が<a href="http://%20http://tulipindia.biz/associate_form.php" rel="nofollow">this form</a>を持って
- 7. <a href="https://jsfiddle.net/wdta5v3q/" rel="nofollow noreferrer">this jsfiddle</a>にあるように、コンテナ(ブートストラップ)
- 8. フラスコ-ログインパッケージは<a href="http://flask.pocoo.org/" rel="nofollow">Flask</a> 0.8で
- 9. <a href="http://www.iol.ie/~murtaghd/stef/service.html" rel="nofollow noreferrer">this page</a>で
- 10. 例<a href="http://people.iola.dk/olau/flot/examples/interacting.html" rel="noreferrer">here</a>からFLOT
- 11. は<a href="http://www.pygame.org/docs/ref/rect.html" rel="nofollow">documentation</a>から何か
- 12. 私はターミナルで<a href="http://beginrescueend.com/rvm/install/" rel="nofollow">http://beginrescueend.com/rvm/install/</a>と<a href="http://beginrescueend.com/rvm/basics/" rel="nofollow">http://beginrescueend.com/rvm/basics/</a></p> <p>上のすべての指示に従ってきたルビー
- 13. クラスインスタンスメソッド?オブジェクトメソッド? <a href="http://en.wikipedia.org/wiki/Method_%28computer_programming%29#Class_methods" rel="nofollow">Wikipedia</a>によれば
- 14. <a href="http://en.wikipedia.org/wiki/Linear_congruential_generator" rel="nofollow">Wikipedia</a>によれば、線形合同法
- 15. $アヤックスからstatusCode機能が<a href="http://api.jquery.com/jQuery.ajax/" rel="nofollow">official jQuery doc</a>によるパラメータ
- 16. 私は<a href="http://doc.qt.io/archives/qt-4.7/qtcpserver.html" rel="nofollow">QTcpServer</a>のサブクラスを持ってQTcpServer
- 17. は、私は<a href="http://en.wikipedia.org/wiki/Microsoft_Blend" rel="nofollow noreferrer">Expression Blend</a> 4(<a href="https://en.wikipedia.org/wiki/Windows_Phone" rel="nofollow noreferrer">Windows Phone</a> 7のために)、私は(資産)のすべての行動がロードされている起動すると
- 18. は<a href="http://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.fmin_slsqp.html#scipy.optimize.fmin_slsqp" rel="nofollow noreferrer">fmin_slsqp</a>を使ってPython
- 19. のGimp:Pythonスクリプトは、私が<a href="http://www.ibm.com/developerworks/library/os-autogimp/" rel="noreferrer">this</a>チュートリアルに従っ
- 20. <a href
- 21. MySQLでのステートメントは、作品は次のように場合<a href="http://dev.mysql.com/doc/refman/5.7/en/control-flow-functions.html#function_if" rel="nofollow">docs</a> Aに従って
- 22. は、Mozillaがおよそ<a href="https://developer.mozilla.org/en-US/docs/DOM/FileReader" rel="nofollow">fileReader</a>ドキュメントを読んIDL
- 23. plistの欠点? <a href="http://en.wikipedia.org/wiki/Windows_Registry#Criticism" rel="nofollow">Wiki</a>によると
- 24. は私が<a href="https://www.mercurial-scm.org/quickstart" rel="nofollow noreferrer">this article</a>に従っ
- 25. チェック一つのオブジェクトがCodeIgniterのと<a href="http://datamapper.wanwizard.eu/" rel="nofollow">Datamapper</a>を使用してDataMapperの
- 26. 展開煎茶/ jQueryのモバイルつのタッチが、私は<a href="http://www.sencha.com/products/touch/" rel="nofollow">Sencha</a>または<a href="http://jquerymobile.com/demos/1.0a2/" rel="nofollow">JQuery Mobile</a>を使用して思っていたアンドロイド/ IPhone
- 27. タグ内<a href="....."></a></td> DOUBLE_WHITESPCE in query href
- 28. ハイライトは、私は次のコードを持っている<a href="https://github.com/mojombo/jekyll" rel="nofollow">jekyll</a></p> <p>で<a href="http://pygments.org/" rel="nofollow">pygments</a>を使用したい
- 29. Firefoxの/ jQueryのは、だから私は2つの画像ギャラリー、<a href="http://devkick.com/lab/galleria/" rel="nofollow noreferrer">Galleria</a>と<a href="http://leandrovieira.com/projects/jquery/lightbox/" rel="nofollow noreferrer">Lightbox</a>を結合しようとしていますimg要素
- 30. <a href="http://martinfowler.com/eaaCatalog/repository.html" rel="nofollow">Martin Fowler</a>によると、リポジトリパターン論争