我已经阅读了几篇关于sso的文章,但在我的脑海中找不到答案.我有一个如下情况:
场景:
题:
如果用户尝试在xyz域中打开页面,系统如何理解用户之前登录过?我的意思是xyz域无法访问具有jwt 的abc的cookie .应该向xyz发送哪些信息表明用户X正在尝试登录?
提前致谢
我正在尝试登录表单组件,但我无法读取表单数据.
当我尝试在控制台上编写用户名时,'undefined'写道.
一切似乎都很平常,但表格数据并不是组件.
以下是html代码:
<form (ngSubmit)="onSubmit(myForm)"
#myForm="ngForm"
class="form-signin">
<div class="form-group">
<h2 class="form-signin-heading">Please sign in</h2>
<input type="text"
id="inputUsername"
name="inputUsername"
class="form-control"
placeholder="User Name"
required>
<input type="password"
id="inputPassword"
name="inputPassword"
class="form-control"
placeholder="Password" >
</div>
<button class="btn btn-lg btn-primary btn-block"
type="submit">Sign in</button>
</form>
Run Code Online (Sandbox Code Playgroud)
组件ts:
@Component({
selector: 'signin',
templateUrl: './signin.component.html',
encapsulation: ViewEncapsulation.None
})
export class SigninComponent implements OnInit{
constructor(){}
ngOnInit(){ }
onSubmit(form: NgForm){
console.log(form.value.inputUsername);
}
}
Run Code Online (Sandbox Code Playgroud)
提前致谢.
我有一个集合,有3个文件,如下所示:
Collection:
{
name: "A",
arr: [1, 2, 3],
arr1: [4, 5, 6]
},
{
name: "B",
arr: [3, 7, 11],
arr1: [5, 6, 9]
},
{
name: "C",
arr: [3, 4, 5],
arr1: [7, 9, 12]
}
Run Code Online (Sandbox Code Playgroud)
我想在集合中搜索下面的数组.
但是所有数组值必须在字段"arr"或"arr1"中匹配.
我的意思是数组值可以在任一字段中,但所有值必须在文档中.
因此,当我在集合中搜索数组时,只有第二个名称为"B",第三个名称为:"C"文档应该是结果.
因为在第二份文件中; "arr"字段中的第一个数组值(3)以及"arr1"字段中的第二个和第三个数组值(5和9).在第三个文档中,"arr"字段中的第一个和第二个(3,5)数组值以及"arr1"字段中的第三个数组值(9).
Array : [3, 5, 9]
Run Code Online (Sandbox Code Playgroud)
你能帮助我吗?
我有一个 Angular 2 项目和一个 NodeJs 项目。我在 Angular 2 应用程序中有一个 iframe,我想在其中显示 NodeJS 应用程序。我想使用 postMessage() 方法从 Angular2 到 NodeJs,然后反向(从 NodeJs 到 Angular2)。Angular2 地址是http://localhost:3001,NodeJs 地址是http://localhost:3005。
在 Angular 2 中,我在组件中有一个这样的模板;
template: `<iframe id="ifrm" #ifrm [src]="iframeURL()" width="500" height="200"> <p> Your browser does not support iframes</p> </iframe> `
Run Code Online (Sandbox Code Playgroud)
iframeURL() {
return this.sanitizer.bypassSecurityTrustResourceUrl('http://localhost:3005');
}
Run Code Online (Sandbox Code Playgroud)
@ViewChild('ifrm') iframe: ElementRef;
Run Code Online (Sandbox Code Playgroud)
异常:DOMException:阻止了一个带有“ http://localhost:3001 ”的框架访问跨源框架。
this.iframe.nativeElement.contentWindow.postMessage('{}','http://localhost:3005');
Run Code Online (Sandbox Code Playgroud)
无法在“DOMWindow”上执行“postMessage”:提供的目标源(“ http://localhost:3005 ”)与收件人窗口的源(“ http://localhost:3001 ”)不匹配。
import {Component, …
Run Code Online (Sandbox Code Playgroud) angular ×2
cross-domain ×1
forms ×1
iframe ×1
jwt ×1
mongodb ×1
node.js ×1
postmessage ×1
typescript ×1