我确信这是可能的,但不确定如何实现.我有一个OWIN OAUTH实现,它当前接受用户的用户名和密码,并根据数据库对它们进行身份验证.我想扩展它以通过SmartCard Uid来支持使用SmartCard进行单点登录.
我可以在OWIN登录中传递其他参数吗?如果是,如何传递?基本前提是用户可以使用用户名/密码组合或SmartCard uid登录(如果通过SmartCard uid并且在数据库中找到,则应用程序将登录用户)
我目前正在传递username,password并且grant_type我想添加uid到该列表中并在我的内容中选择它AuthorizationServiceProvider.
我可以看到UserName,Password并且ClientId对OAuthGrantResourceOwnerCredentialsContext,但我看不出这将支持什么,我想实现的任何其他属性.
这是我目前在我的服务提供商中所拥有的
public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context)
{
context.OwinContext.Response.Headers.Add("Access-Control-Allow-Origin", new[] { "*" });
var user = await this._userService.FindUser(context.UserName, context.Password);
if (user == null)
{
context.SetError("invalid_grant", "The user name or password is incorrect.");
return;
}
var identity = new ClaimsIdentity(context.Options.AuthenticationType);
identity.AddClaim(new Claim(ClaimTypes.Sid, user.Id.ToString()));
identity.AddClaim(new Claim(ClaimTypes.Role, "user"));
identity.AddClaim(new Claim("sub", context.UserName));
var secretKeyBytes = Encoding.UTF8.GetBytes(user.PasswordHash);
var props …Run Code Online (Sandbox Code Playgroud) 我只是选择了Angular 6和CLI并创建了一个项目,如下所示
ng new my-demo
cd my-demo
ng g library foo --prefix=my
Run Code Online (Sandbox Code Playgroud)
不在我的库中我想添加,ngx-bootstrap因为组件需要,DropdownButtonModule所以我的问题是我如何安装库的npm包?
我以前刚刚运行npm install ngx-bootstrap但现在将为应用程序安装软件包,但是,我需要为库安装此软件包.我应该cd到库文件夹并运行npm install还是有另一种方法,这是使用CLI完成的?
好的,我有一个用于/ token请求的WebAPI Auth服务,并将Bearer令牌返回给客户端,我已经为属性添加了AppId和Api Key,所以我回来了
{
"access_token": "...",
"token_type": "bearer",
"expires_in": 86399,
"dm:appid": "1",
"dm:apikey": "...",
".issued": "Wed, 01 Jul 2015 20:46:45 GMT",
".expires": "Thu, 02 Jul 2015 20:46:45 GMT"
}
Run Code Online (Sandbox Code Playgroud)
客户端应使用AppId和Api密钥为每个请求生成Hmac SHA256签名.
在我的控制器上,我使用了Authorize属性并创建了一个实现IAuthenticationFilter的HmacAuthentication属性
[RoutePrefix("api/account")]
[Authorize]
[HmacAuthentication]
public class AccountController : ApiController
{
// rest of controller here
}
Run Code Online (Sandbox Code Playgroud)
我遇到的问题是,对此控制器的任何请求都会期望Authorization: Bearer ...标头和HmacAuthentication属性也需要Authorization: amx标头.
现在我知道你只能拥有一个Authorization标头,所以我的quandry是如何在不破坏HTTP的情况下实现两个Authorization标头,是否有人实现了OWIN OAuth和HMAC认证的使用
我跟随了Taiseer Joudeh的这些例子
使用ASP.NET Web API 2,Owin和Identity Secure ASP.NET Web API使用API密钥身份验证进行基于令牌的身份验证 - HMAC身份验证
我最近观看了Steve Smith 和 Julie Lerman 在 Pluralsight 上的领域驱动设计基础,这是一门很棒的课程,但是我是否有与 EF Code-First 和 DDD 相关的问题,我了解了丰富实体的概念并且实际上理解了大多数的 DDD,但我很难理解在 DDD 中使用 EF Code-First。假设我有两个有界上下文,并且在每个有界上下文中都有一个 Customer 实体,共享一个 Id 和 Name。
namespace Accounts
{
public class Customer : Entity
{
public Guid Id { get; private set; }
public string Name { get; private set; }
public string AccountNo { get; private set; }
}
}
namespace Deliveries
{
public class Customer : Entity
{
public Guid Id { get; private set; }
public string Name …Run Code Online (Sandbox Code Playgroud) 有没有人知道如何使用Swift以编程方式创建SKTileMapNode?(注意:我不想使用编辑器执行此操作,我只想以编程方式实现此操作)
我尝试了以下但不渲染我的瓷砖地图
let bgTexture = SKTexture(imageNamed: "background")
let bgDefinition = SKTileDefinition(texture: bgTexture, size: bgTexture.size())
let bgGroup = SKTileGroup(tileDefinition: bgDefinition)
let tileSet = SKTileSet(tileGroups: [bgGroup])
let bgNode = SKTileMapNode(tileSet: tileSet, columns: 5, rows: 5, tileSize: bgTexture.size())
bgNode.position = CGPoint(x: self.frame.size.width / 2, y: self.frame.size.height / 2)
bgNode.setScale(1)
self.addChild(bgNode)
Run Code Online (Sandbox Code Playgroud)
任何帮助非常感谢
如何以模型驱动的形式表示字典,在我的模型中,我有一个选项数组,每个选项显示一个标签和两个链接的下拉列表,一旦选择,两个下拉列表的值应存储在字典中关键是选择 ID,所以我的模型看起来像这样
const model = {
choices: Choice[],
logic: { [key: string]: ChoiceLogic }
}
Run Code Online (Sandbox Code Playgroud)
我将如何在模型驱动的表单中表示这一点,以及如何将数据绑定到生成的表单组?
有人可以帮忙解决Angular 6问题吗?
我有一个角6 CLI项目(应用程序),并增加了两个库(可以打电话给他们libA,并libB和libA需要的部件从libB)
我已经导入libB了我的libA模块导入,但是在构建时libA我得到一个错误,它无法找到模块
libB模块
我的libA模块是
import {LibBModule} from ‘@scope/libb’;
…
@NgModule({
imports: [
LibBModule
]
})
export class LibAModule { }
Run Code Online (Sandbox Code Playgroud)
在我的根tsconfig路径中我有
“@scope/lib1": [
"dist/@scope/liba"
],
“@scope/libb": [
"dist/@scope/libb"
]
Run Code Online (Sandbox Code Playgroud)
我已经构建libB并且构建良好并且位于上面的位置,但是当我构建时,libA我得到以下错误
error TS2307: Cannot find module ‘@scope/libb’
Run Code Online (Sandbox Code Playgroud)
我做错了什么?(注意:我正在将libA模块导入我的根项目,这很好),请帮忙吗?
有人知道是否有可能创建一个"列"组件用于mat-table,我尝试为常用的列定义创建一个组件但是当添加到表时我得到一个无法找到列选择器的错误,我的专栏定义如下:
@Component({
selector: 'iam-select-column',
template: `
<ng-container matColumnDef="select">
<mat-header-cell *matHeaderCellDef>
<mat-checkbox></mat-checkbox>
</mat-header-cell>
<mat-cell *matCellDef="let row">
<mat-checkbox></mat-checkbox>
</mat-cell>
</ng-container>
`,
styles: [`
`]
})
export class SelectColumnComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
Run Code Online (Sandbox Code Playgroud)
并在表中使用它
<mat-table class="mat-elevation-z8">
<iam-select-column></iam-select-column>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row>
</mat-table>
Run Code Online (Sandbox Code Playgroud)
和displayedColumns是:
displayedColumns = [
'select'
];
Run Code Online (Sandbox Code Playgroud)
是否可以这样做,因为我想避免在我有一个选择列的表中重复?
好吧,请耐心等待,这可能需要一些解释,因此我有一个简单的帐户控制器;
[RoutePrefix("api/account")]
[Authorize]
[HmacAuthentication]
public class AccountController : ApiController
{
public async Task<IHttpActionResult> Register(UserModel userModel)
{
if (!this.ModelState.IsValid)
{
return this.BadRequest(this.ModelState);
}
IdentityResult result = await this._userService.RegisterUser(userModel);
var errorResult = this.GetErrorResult(result);
if (errorResult != null)
{
return errorResult;
}
return this.Ok();
}
}
Run Code Online (Sandbox Code Playgroud)
HmacAuthentication属性在这里:
public class HmacAuthenticationAttribute : Attribute, IAuthenticationFilter
{
public Task AuthenticateAsync(HttpAuthenticationContext context, CancellationToken cancellationToken)
{
...
var isValid = this.IsValidRequest(req, appId, incomingBase64Signature, nonce, requestTimeStamp);
if (isValid.Result)
{
...
}
...
}
private async Task<bool> IsValidRequest(
HttpRequestMessage req, …Run Code Online (Sandbox Code Playgroud) 我正在实现一个具有MVC客户端的解决方案(让我们在localhost:4077 /上调用此CLIENT),其中包含一个WebAPI服务(在localhost上称为API:4078 /)
我在API中实现了OWIN OAuth,但是想知道OWIN是否可以在单独的解决方案中实现(让我们在localhost:4079/token上调用AUTH)来为CLIENT生成令牌,然后CLIENT将其传递给API (作为承载授权令牌)
我查询的原因是,CLIENT可能会访问其他WebAPI服务,我想在客户端和所有API服务之间使用OWIN.
问题是我不确定AUTH服务生成的令牌是否可用于授权CLIENT和所有API服务上的所有请求.
有没有人实现这样的任何东西,如果是这样你能提供一个例子,我是OWIN和OAUTH的新手,所以任何帮助将不胜感激