ServiceStack が独自の OAuth2 サーバーに対して認証するための AuthProvider を作成していますが、ServiceStack がプロバイダーと対話する方法に問題があります。
https://groups.google.com/d/msg/servicestack/e3kkh-qRDYs/DF9Y05ibl-MJによると
拡張には通常 2 つの方法があります。独自の OAuth 実装を提供する場合は、サブクラス AuthProvider (または IAuthProvider を実装) し、サービスの実装全体を保持する Authenticate() メソッドをオーバーライドします。AuthService には独自の実際の実装はありません。Auth Provider .IsAuthorized() メソッドをチェックして、ユーザーが既に認証されているかどうかを確認し、認証されていない場合は Authenticate() メソッドを呼び出します。【私のこだわり】
現在、私の認証プロバイダー全体は次のようになっています。
using System;
using ServiceStack.ServiceInterface;
using ServiceStack.ServiceInterface.Auth;
namespace SpotAuth.ResourceServer.Services {
public class SpotlightOAUthProvider : AuthProvider {
public override bool IsAuthorized(IAuthSession session, IOAuthTokens tokens, Auth request = null) {
return (false);
}
public override object Authenticate(IServiceBase authService, IAuthSession session, Auth request) {
// A breakpoint on this line is never reached; the service just returns Unauthorized.
throw new NotImplementedException();
}
}
}
Authenticate メソッドが呼び出されないのはなぜですか? 上にリンクされているフォーラムの投稿はほぼ 1 年前のものですが、この動作が廃止されたことを示唆するものは見つかりません。