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. Highchartsは、次のよう<a href="http://api.highcharts.com/highcharts/yAxis.minPadding" rel="nofollow">docs</a>によれば、軸パディング
- 3. Rプロット:(。<a href="https://commons.wikimedia.org/wiki/File:All_palaeotemps.svg" rel="nofollow noreferrer">Original image</a>と<a href="http://gergs.net/?attachment_id=4310" rel="nofollow noreferrer">data</a>)非一様番号
- 4. Androidはどのように<a href="https://developer.android.com/studio/publish/versioning.html" rel="nofollow">this</a>ページで
- 5. はどのように<a href="https://developer.android.com/reference/android/media/MediaPlayer.html#getDuration()" rel="nofollow noreferrer">MediaPlayer</a>からアンドロイド
- 6. Angular 2がCommonJsモジュール形式で記述されているのはなぜですか?彼の<a href="https://addyosmani.com/writing-modular-js/" rel="nofollow">article</a>に<a href="https://twitter.com/addyosmani" rel="nofollow">ADDY OSMANI</a>で述べたように
- 7. は、私は<a href="https://redom.js.org" rel="nofollow noreferrer">redom</a>ライブラリをインポートしようとしています
- 8. が<a href="https://www.gnu.org/software/libc/" rel="nofollow noreferrer">glibc</a>で
- 9. は、どのように私は<a href="http://controlsjs.com/" rel="nofollow">Hello demo</a></p> <p>をしようとしていた
- 10. <a href="http://www.exampleSite.com/aPage.php" rel="nofollow">http://www.exampleSite.com/aPage.php</a>に正しく
- 11. は、どのように私は以下のように<a href="http://www.django-rest-framework.org/api-guide/viewsets/" rel="nofollow noreferrer">viewset</a>を持っている認証
- 12. <a href="http://www.sislands.com/coin70/week6/encoder.htm" rel="nofollow">this</a>ページ内のURLパーセントエンコーディング
- 13. 城ウィンザー:<a href="http://mef.codeplex.com/" rel="nofollow">MEF</a>では既存のオブジェクト
- 14. <a href="http://codeforces.com/contest/659/problem/B" rel="nofollow">Problem</a>の配列
- 15. 私は(<a href="https://search.google.com/structured-data/testing-tool" rel="nofollow noreferrer">Google Structured Data Test Tool</a>がやって道のような)プログラムでHTMLコンテンツから<a href="http://schema.org/" rel="nofollow noreferrer">microdata schema</a>を解析するミクロスキーマパーサ
- 16. implementions()は次のよう<a href="https://golang.org/src/sync/rwmutex.go" rel="nofollow noreferrer">src/sync/rwmutex.go</a>ファイルにgolang
- 17. Akkaの俳優システムでtell()はどのように機能しますか?ドキュメント<a href="http://doc.akka.io/api/akka/2.4/#akka.actor.Actor" rel="nofollow noreferrer">here</a>と<a href="http://doc.akka.io/api/akka/2.4/#akka.actor.ActorRef" rel="nofollow noreferrer">here</a></p> <p>を見
- 18. <a href="https://jsfiddle.net/wdta5v3q/" rel="nofollow noreferrer">this jsfiddle</a>にあるように、コンテナ(ブートストラップ)
- 19. SearchViewはここ<a href="https://imgur.com/a/Z9dTQ" rel="nofollow noreferrer">http://imgur.com/a/Z9dTQ</a></p> <p>見られるように、スイッチタブ
- 20. の画像は、私はgithubのページに<a href="http://calebbertrand.github.io" rel="nofollow noreferrer">website</a>を持って
- 21. Tabキーは、私が<a href="http://%20http://tulipindia.biz/associate_form.php" rel="nofollow">this form</a>を持って
- 22. は <a href="http://tinkerpop.apache.org/docs/3.2.1-SNAPSHOT/recipes/" rel="nofollow">this</a> 次のクエリによればdatastax DSEグラフ
- 23. 私は<a href="https://www.primefaces.org/primeng/#/" rel="nofollow noreferrer">PrimeNG</a><p> </p><a href="https://www.primefaces.org/" rel="nofollow noreferrer">primefaces.org</a>からすべてがうまく機能している使用しています
- 24. 私はターミナルで<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>上のすべての指示に従ってきたルビー
- 25. パイソンはrandom.Random - <a href="https://docs.python.org/3.4/library/random.html#random.random" rel="nofollow">documentation</a>で説明したように0
- 26. <a href="http://www.iol.ie/~murtaghd/stef/service.html" rel="nofollow noreferrer">this page</a>で
- 27. は<a href="https://openthread.io/certification/prerequisites" rel="nofollow noreferrer">OpenThread Certification Prerequisites</a>オン
- 28. 例<a href="http://people.iola.dk/olau/flot/examples/interacting.html" rel="noreferrer">here</a>からFLOT
- 29. フラスコ-ログインパッケージは<a href="http://flask.pocoo.org/" rel="nofollow">Flask</a> 0.8で
- 30. 可能な実装:: <a href="http://cppreference.com/" rel="nofollow">cppreference.com</a>上equal_range