小编Mik*_*e42的帖子

使用材质对话框在 Angular Elements 上显示问题(ShadowDom 问题?)

我将与 Angular 7 上的 Angular Elements 取得联系,以构建可以简单地部署在现有网页中的轻量级 Web 组件。第一次测试很有希望,但是我在使用基于 Angular Material (MatDialog) 的对话框时遇到了显示问题。如果我将 Angular 组件 (FilterComponent) 构建为 Angular 元素并在简单的 HTML5 网页中运行生成的 Web 组件,则对话框将直接显示在基础网页上,而不是分离的框。

我使用当前稳定版本的 Angular/cli 7.3.8。

app.module.ts:

@NgModule({
  declarations: [
    AppComponent,
    SearchElementComponent,
    FilterDialogComponent,
    FilterComponent,
  ],
  imports: [
    BrowserModule,
    BrowserAnimationsModule,
    FormsModule,
    MaterialModule,
    ReactiveFormsModule,
  ],
  entryComponents: [SearchElementComponent, FilterComponent, FilterDialogComponent]
})
export class AppModule {
  constructor(private injector: Injector) {
  }

  ngDoBootstrap() {
    // Convert `SearchElementComponent` to a custom element.
    const SearchElementElement = createCustomElement(SearchElementComponent, {injector: this.injector});
    // Register the custom element with the browser. …
Run Code Online (Sandbox Code Playgroud)

dialog element shadow-dom angular

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

了解 Django CSRF_COOKIE_SAMESITE 和 CSRF_TRUSTED_ORIGINS

显然我在理解跨域环境中关于CSRF参数的Django(2.2.4)设置的影响时遇到了问题。

正如我已经注意到我必须设置 SESSION_COOKIE_SAMESITE = None是否要将我的 Django 应用程序放入具有另一个域的网站的 iframe(例如 foo.com 上的 Django 应用程序和 bar.com 上的 iframe),以便在我的 Django 应用程序上发送表单.

但是,CSRF 参数是什么?经过一些试验,我注意到如果我也在CSRF_COOKIE_SAMESITE = NoneDjango 设置中进行了设置,我只能在 iframe 中发送 Django 表单。

但是有什么CSRF_TRUSTED_ORIGINS用呢?如果我将 iframe 域(例如 bar.com)设置为列表['bar.com']而不是CSRF_COOKIE_SAMESITE = None我无法在 iframe 中的 Django 应用程序上发送表单。

任何人都可以解释在什么情况下 CSRF_TRUSTED_ORIGINS有什么影响吗?它是否只能在具有一个域和多个子域的环境中使用?

感谢您的任何提示!

django iframe csrf cross-domain

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

标签 统计

angular ×1

cross-domain ×1

csrf ×1

dialog ×1

django ×1

element ×1

iframe ×1

shadow-dom ×1