HttpContext.Session
をGrantResourceOwnerCredentials
の方法で取得する必要があります。しかし、Httpcontext.Session
にアクセスしようとするとnull
になります。GrantResourceOwnerCredentialsのhttpcontext.sessionにアクセス
は私のコードです:
public void ConfigureAuth(IAppBuilder app)
{
PublicClientId = "self";
OAuthOptions = new OAuthAuthorizationServerOptions
{
TokenEndpointPath = new PathString("/Token"),
Provider = new ApplicationOAuthProvider(
PublicClientId,
DependencyResolver.Current.GetService<ApplicationUserManager>(),
HttpContext.Current),
//AuthorizeEndpointPath = new PathString("/api/Account/ExternalLogin"),
AccessTokenExpireTimeSpan = TimeSpan.FromMinutes(3),
// In production mode set AllowInsecureHttp = false
AllowInsecureHttp = true,
RefreshTokenProvider = new RefreshTokenProvider(
DependencyResolver.Current.GetService<ApplicationDbContext>())
};
// Enable the application to use bearer tokens to authenticate users
app.UseOAuthBearerTokens(OAuthOptions);
}
私は私HttpContext
セッション値を設定するSAMLを使用しますが、私は私のGrantResourceOwnerCredentials
方法に再び再確認することをSession
値する必要がありますが、セッションは常にnullであるしかし、ここに。