小编Lór*_*óda的帖子

如何在客户端获取DotNetOpenAuth.OAuth2返回的错误消息?

我正在使用ExchangeUserCredentialForToken函数从授权服务器获取令牌.当我的用户存在于我的数据库中时,它工作正常,但是当凭据是incorect时,我想向客户端发回消息.我正在使用以下2行代码来设置错误消息:

context.SetError("Autorization Error", "The username or password is incorrect!");
context.Rejected();
Run Code Online (Sandbox Code Playgroud)

但在客户端,我只得到协议错误(错误400).您能帮我解决一下如何在授权服务器上获取服务器端设置的错误消息?

来自授权服务器的完整应用程序配置:

using Constants;
using Microsoft.Owin;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.Cookies;
using Microsoft.Owin.Security.Infrastructure;
using Microsoft.Owin.Security.OAuth;
using Owin;
using System;
using System.Collections.Concurrent;
using System.Linq;
using System.Security.Claims;
using System.Security.Principal;
using System.Threading.Tasks;
using AuthorizationServer.Entities;
using AuthorizationServer.Entities.Infrastructure.Abstract;
using AuthorizationServer.Entities.Infrastructure.Concrete;

namespace AuthorizationServer
{
    public partial class Startup
    {
        private IEmployeeRepository Repository;  
        public void ConfigureAuth(IAppBuilder app)
        {
            //instanciate the repository
            Repository = new EmployeeRepository();

            // Enable Application Sign In Cookie
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = …
Run Code Online (Sandbox Code Playgroud)

c# dotnetopenauth asp.net-web-api bearer-token

21
推荐指数
2
解决办法
1万
查看次数

如何使用数据库绑定向WPF中的组合框添加选项"All"

ComboBox在WPF中有以下内容.我知道我可以ALL使用CompositeCollection 添加选项,但我不知道如何.如果有人帮我解决一个简短的教程,那将会很棒.

<ComboBox SelectionChanged="ComboBoxOperatingPoints_SelectionChanged" 
          x:Name="ComboBoxOperatingPoints" 
          DropDownOpened="ComboBoxOperatingPoints_DropDownOpened_1"
          FontSize="30" 
          HorizontalAlignment="Right" 
          Margin="40,40,0,0" 
          VerticalAlignment="Top" 
          Width="200" 
          Height="50"
          IsSynchronizedWithCurrentItem="True"
          ItemsSource="{Binding OperatingPoints}"
          DisplayMemberPath="name"
          SelectedValue="{Binding OperatingPointID,UpdateSourceTrigger=PropertyChanged,TargetNullValue=''}"
          SelectedValuePath="operating_point_id">
</ComboBox>
Run Code Online (Sandbox Code Playgroud)

.net wpf combobox compositecollection

5
推荐指数
1
解决办法
3319
查看次数

Visual Studio HTML文件中的Angular Syntax Highlighter

有时很多角度和代码都出现在html文件中.对于代码和指令,使用荧光笔可以更容易地查看文件中的内容.

有没有这种语法高亮能力的工具?

syntax-highlighting visual-studio angularjs

5
推荐指数
1
解决办法
551
查看次数

Owin OAuth提供程序"实体类型IdentityUser不是当前上下文模型的一部分"

UserManagerFactory = () => new UserManager<IdentityUser>(new UserStore<IdentityUser>());
OAuthOptions = new OAuthAuthorizationServerOptions
{
    TokenEndpointPath = new PathString("/Token"),
    Provider = new ApplicationOAuthProvider(PublicClientId, UserManagerFactory),
    AuthorizeEndpointPath = new PathString("/api/AccountOwin/ExternalLogin"),
    AccessTokenExpireTimeSpan = TimeSpan.FromDays(14),
    AllowInsecureHttp = true
};
Run Code Online (Sandbox Code Playgroud)

IdentityUser,UserStore来自哪个实体框架.

我想使用我的数据库而不是本地数据库,我从本地数据库表生成"生成"脚本,我在自定义数据库中创建它们但是当我在下面的行中显示数据库上下文时:

UserManagerFactory = () => new UserManager<IdentityUser>(new UserStore<IdentityUser>(new MyCustomDBEntities()));
Run Code Online (Sandbox Code Playgroud)

MyCustomDBEntities是实体框架中的自定义数据库(edmx)我收到以下错误:"实体类型IdentityUser不是当前上下文模型的一部分"

我做错了什么?我应该创建自己的Usermanager吗?

public class MyCustomDBEntities : IdentityDbContext<IdentityUser>
    {
        public MyCustomDBEntities()
            : base("name=ConnectionStringName")
        {
        }
    }
Run Code Online (Sandbox Code Playgroud)

c# wif

1
推荐指数
1
解决办法
3056
查看次数