OWIN/Katana를 통해 Umbraco에서 소비하는 OAuth 인증 서버로 회사 웹 사이트를 사용하여 개념 증명을 개발하려고합니다. 모든 OAuth 배관은 잘 작동하는 것으로 보이지만 Umbraco는 외부 ID를 로컬 ID로 변환하지 않습니다. Umbraco 백엔드에 로그인하는 대신 사용자는 로그인 페이지로 되돌아갑니다. OAuth 흐름이 완료되면 Umbraco가 긴 암호화 문자열을 포함하는 UMB_EXTLOGIN 쿠키를 생성 한 유일한 변경 사항입니다.외부 OAuth ID를 Umbraco의 로컬 ID로 변환하려면 어떻게해야합니까?
로컬 ID (Umbraco 백엔드 로그인 페이지의 사용자 이름 및 암호)를 사용하여 직접 로그인하면 Umbraco는 UMB_UCONTEXT, UMB_UPDCHK, XSRF-TOKEN 및 XSRF-V의 4 가지 쿠키를 생성합니다. 나는 외부의 정체성을 지역의 정체성으로 변환시키는 무언가를 놓치고 있다고 생각하지만, 그것이 무엇인지는 잘 모르겠습니다.
Startup.Auth.cs
public partial class Startup
{
public void ConfigureAuth(IAppBuilder app)
{
app.ConfigureBackOfficeMyCompanyAuth(Properties.Settings.Default.ClientId, Properties.Settings.Default.ClientSecret);
}
}
UmbracoMyCompanyAuthExtensions.cs
public static class UmbracoMyCompanyAuthExtensions
{
public static void ConfigureBackOfficeMyCompanyAuth(this IAppBuilder app, string clientId, string clientSecret,
string caption = "My Company", string style = "btn-mycompany", string icon = "fa-rebel")
{
var options = new MyCompanyAuthenticationOptions
{
ClientId = clientId,
ClientSecret = clientSecret,
SignInAsAuthenticationType = Constants.Security.BackOfficeExternalAuthenticationType,
Provider = new MyCompanyAuthenticationProvider(),
CallbackPath = new PathString("/MyCompanySignIn")
};
options.ForUmbracoBackOffice(style, icon);
options.Caption = caption;
app.UseMyCompanyAuthentication(options);
}
}
MyCompanyAuthenticationExtension.cs
public static class MyCompanyAuthenticationExtensions
{
public static IAppBuilder UseMyCompanyAuthentication(this IAppBuilder app, MyCompanyAuthenticationOptions options)
{
if (app == null)
{
throw new ArgumentNullException("app");
}
if (options == null)
{
throw new ArgumentNullException("options");
}
app.Use(typeof(MyCompanyAuthenticationMiddleware), new object[] { app, options });
return app;
}
public static IAppBuilder UseMyCompanyAuthentication(this IAppBuilder app, string clientId, string clientSecret)
{
MyCompanyAuthenticationOptions options = new MyCompanyAuthenticationOptions
{
ClientId = clientId,
ClientSecret = clientSecret
};
return app.UseMyCompanyAuthentication(options);
}
}
사용자 정의 구현 AuthenticationHandler<T>.AuthenticateCoreAsync()
은 다음 클레임 및 특성을 사용하여 AuthenticationTicket을 반환합니다.
주장
- givenName과 = 내 이름
- FamilyName = 내 성
- 이름 = 내 전체 이름
- 이메일 = 이메일 주소
속성
- .redirect =/umbraco/