ASP.NETMVCの実行可能な代替手段としてOpenRastaを使用する可能性をテストしています。しかし、私は認証に関してつまずきに遭遇しました。
はっきりさせておきますが、現時点では「オープンダイジェスト認証」はオプションではありません。
Scott LittlewoodがOpenRastaの基本認証フォークを作成したことを読み、gitからソースをダウンロードして正常にビルドしました。
私は今、認証を機能させようとしているので、誰かが実際に機能するモデルを持っているなら、私は非常に感謝するでしょう。これが私がこれまでにしたことです:
//Authentication.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using OpenRasta;
using OpenRasta.Configuration;
using OpenRasta.Authentication;
using OpenRasta.Authentication.Basic;
using OpenRasta.Configuration.Fluent;
using OpenRasta.DI;
namespace myOpenRastaTest.Extensions
{
public static class ExtensionsToIUses
{
public static void BasicAuthentication<TBasicAuthenticator>(this IUses uses) where TBasicAuthenticator : class, IBasicAuthenticator
{
uses.CustomDependency<IAuthenticationScheme, BasicAuthenticationScheme>(DependencyLifetime.Transient);
uses.CustomDependency<IBasicAuthenticator, TBasicAuthenticator>(DependencyLifetime.Transient);
}
}
public class CustomBasicAuthenticator : IBasicAuthenticator
{
public string Realm { get { return "stackoverflow-realm"; } }
public CustomBasicAuthenticator()
{
}
public AuthenticationResult Authenticate(BasicAuthRequestHeader header)
{
/* use the information in the header to check credentials against your service/db */
if (true)
{
return new AuthenticationResult.Success(header.Username);
}
return new AuthenticationResult.Failed();
}
}
}
それをテストするために、HomeHandler.csにCustomBasicAuthenticatorのインスタンスを作成しました。
//HomeHandler.cs
using System;
using myOpenRastaTest.Resources;
namespace myOpenRastaTest.Handlers
{
public class HomeHandler
{
public object Get()
{
var custAuth = new myOpenRastaTest.Extensions.CustomBasicAuthenticator();
return new HomeResource();
}
}
}
したがって、次に実行する必要のある手順を知る必要があります。したがって、2日前にフレームワークに遭遇したばかりで、すべてのOpenRastaフレームワークを知らない可能性があるため、理論の答えだけでなく、実際の作業モデルを求める理由があります。 、あなたが私に投げ返すかもしれないRESTfulな用語:)
認証を理解したら、既存のasp.netプロトタイプポータルをOpenRastaに移植するかどうかの評価をどのように進めるかについての良い指標が得られます。
前もって感謝します...