小编Nik*_*kov的帖子

Thinktecture身份服务器与授权服务器

我上周正在研究这个话题,不幸的是我无法弄清楚.我理解身份验证和授权之间的区别.

我将非常感谢有关该主题的任何指导.

我需要的一般是对几个用api驱动的网站实现单点登录,这也应该处理身份验证.用户应该能够使用用户名/通行证或通过任何第三方服务(如facebook,google +,twitter等)分别注册/登录.

在上面的场景中,更好的方法是什么?我应该只使用身份服务器,还是只使用授权服

先感谢您.

thinktecture-ident-server

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

Angular 2:属性注入而不是构造函数注入

我可以这样做:

export class BaseComponent {
protected config: IConfig;

@Inject(AppConfig) protected appConfig: AppConfig;

constructor() 
{ 
    this.config = this.appConfig.getConfig();    
}
Run Code Online (Sandbox Code Playgroud)

而不是这个:

export class BaseComponent {
config: IConfig;

constructor(
    private appConfig: AppConfig,
    ) 
{ 
    this.config = appConfig.getConfig();    
}
Run Code Online (Sandbox Code Playgroud)

目标是简化构造函数签名,因此所有子组件都不需要在其构造函数中指定appConfig.所以从BaseComponent继承的组件看起来像这样:

@Component({
    selector: 'sport-templates',
    templateUrl: 'templates.component.html',
    styleUrls: [ 'templates.component.scss' ],
    encapsulation: ViewEncapsulation.None
})
export class SportTemplates extends BaseComponent implements OnInit {

    constructor() {
        super();
    }
Run Code Online (Sandbox Code Playgroud)

而是这样:

@Component({
    selector: 'sport-templates',
    templateUrl: 'templates.component.html',
    styleUrls: [ 'templates.component.scss' ],
    encapsulation: ViewEncapsulation.None
})
export class SportTemplates extends BaseComponent implements OnInit …
Run Code Online (Sandbox Code Playgroud)

dependency-injection typescript angular

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

是否可以在webmethod asmx服务中使用async/await

我想弄明白,但现在没有成功.是否可以在webmethod asmx服务中使用async/await?到目前为止我发现async/await只能在WCF服务方法中使用(休息或其他).

asynchronous asmx webmethod async-await

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

使用WebForms和WebApi思考IdentityServer v3

我正在尝试用一段时间来弄清楚如何使用Thinktecture IdentityServer v3为传统的webforms应用程序解决SSO(单点登录).不幸的是我堆积了.

基础设施是这样的:

  • 需要身份验证和授权的WebForm应用程序(可能是cookie或承载令牌)
  • 一个javascript轻量级应用程序(一旦用户通过身份验证)向WebApi发出请求(在单独的域上)

我有以下问题希望能帮助我解决问题:

  1. 我无法将旧的webforms应用程序重定向到IdentityServer,即使在Web.Config中设置也是如此.我在Startup.cs中有app.UseCookieAuthentication(....)和app.UseOpenIdConnectAuthentication(....)正确设置(我猜).对于MVC,[Authorize]属性强制重定向到IdentityServer.如何为webforms做到这一点?
  2. 一旦用户登录,是否有一种方法可以将存储在cookie中的令牌作为持有者令牌重用于从javascript客户端进行的WebApi调用.我只是想代表当前登录的用户对WebApi做请求(webforms应用程序和webapi再次位于不同的域上)

任何帮助都感激不尽.

谢谢!

asp.net webforms asp.net-web-api thinktecture-ident-server

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

NHibernate QueryOver与子查询或其他想法如何工作?

我有以下问题:

Model.RampActiveHour rah = null;

var defaultWeekQuery = QueryOver.Of<Model.RampAdditionalDefaultWeek>()
                                   .Where(adw => adw.Ramp == rah.Ramp && 
                                          adw.Active && adw.FromDate <= date &&
                                          adw.ToDate >= date)
                                   .Select(adw => adw.ID).Take(1);
var result = session.QueryOver(() => rah)
                .Where(ah => ah.DayOfWeek == date.DayOfWeek)
                .WhereRestrictionOn(ah => ah.Ramp).IsIn((ICollection) ramps)
                .WithSubquery.WhereProperty(ah=>ah.AdditionalDefaultWeek)
                    .Eq(defaultWeekQuery)
                .List();
Run Code Online (Sandbox Code Playgroud)

结果查询是:

SELECT
 this_.ID as ID3_0_,
 this_.DayOfWeek as DayOfWeek3_0_,
 this_.Active as Active3_0_,
 this_.SlotsCount as SlotsCount3_0_,
 this_.SlotId as SlotId3_0_,
 this_.SlotLength as SlotLength3_0_,
 this_.Date as Date3_0_,
 this_.ramp_id as ramp8_3_0_,
 this_.additional_default_week_id as additional9_3_0_,
 this_.Previous as Previous3_0_,
 this_.Next as Next3_0_ …
Run Code Online (Sandbox Code Playgroud)

nhibernate subquery queryover

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