3

いくつかの追加パラメーターが必要だったので、カスタム ユーザー認証セッションを備えた標準の Hello World Web サービスを使用しています。認証部分は期待どおりに機能します。以下は私のCustomUserSessionです:

public class CustomUserSession : AuthUserSession
{
    public int? PortalId { get; set; }

    public override void OnAuthenticated(ServiceInterface.IServiceBase authService, IAuthSession session, IOAuthTokens tokens, Dictionary<string, string> authInfo)
    {
        base.OnAuthenticated(authService, session, tokens, authInfo);
        var refId = session.UserAuthId;

        var userRep = new InMemoryAuthRepository();
        var userAuth = userRep.GetUserAuth(refId.ToString());
        PortalId = userAuth.RefId;
    }
}

他のテーブルの 1 つからのカスタム パラメーターを保持する refId があり、デバッグ時に正しい値を取得します。私の質問は、このメソッド内から Web サービスのメソッドを呼び出すことができるようになりましたか? たとえば、int を受け入れる execute メソッドがある場合、オーバーライドされた OnAuthenticated メソッド内から呼び出すことはできますか?

4

2 に答える 2

0

ServiceInterface.IServiceBase適切なクラス/インターフェースに解決してみてください。の例を次に示しIDbConnectionFactoryます。

//Resolve the DbFactory from the IOC and persist the info
authService.TryResolve<IDbConnectionFactory>().Exec(dbCmd => dbCmd.Save(PortalId));
于 2014-01-29T19:18:20.083 に答える