简体   繁体   English

将“基本身份验证”替换为“表单身份验证”

[英]Replace "Basic Authentication" with "Form Authentication"

Is there a way to replace "Basic Authentication" with "Form Authentication" in W20?.有没有办法在 W20 中将“基本身份验证”替换为“表单身份验证”? The documentation only refers to the "basicAuth" but not to an authentication with Login (authentication by form).该文档仅提及“basicAuth”,但未提及使用登录的身份验证(通过表单进行身份验证)。 The app is made with AngularJS and W20, in the backend it uses SeedStack and Java 8. Could you help us to solve this problem?该应用程序是用 AngularJS 和 W20 制作的,在后端它使用 SeedStack 和 Java 8. 你能帮我们解决这个问题吗? Thanks谢谢

The documentation only refers to the "basicAuth" but not to an authentication with Login (authentication by form).该文档仅提及“basicAuth”,但未提及使用登录的身份验证(通过表单进行身份验证)。 The app gives a 401 error and opens a popup for username/password registration when loading the URL. The app does not have a LOGIN page.该应用程序在加载 URL 时给出 401 错误并打开用户名/密码注册的弹出窗口。该应用程序没有登录页面。

Hi Hugo Orlando Gonzalez!嗨雨果奥兰多冈萨雷斯!

I'm not very familiar with the W20 library or SeedStack , so I'm going off of my experience using other authentication schemes, so I may be rather abstract.我对W20库或SeedStack不是很熟悉,所以我将脱离我使用其他身份验证方案的经验,所以我可能比较抽象。

According to:根据:

You would have to setup data-ng-submit="form.submit()" to call:您必须设置data-ng-submit="form.submit()"才能调用:

$scope.form = {
  model: { /* ... */ },
  fields: [{ /* the form login fields... */ }],
  submit: function () {
    // send form (XHR, AJAX, fetch, etc.) request to back-end
    // get token for  Authorization  header or get cookie for server session
    // save to LocalStorge or in a cookie, whichever is used on your back-end
  }
}

And then save the token in LocalStorage , or in a cookie that's then checked for authentication on the server.然后将令牌保存在LocalStorage中,或者保存在随后在服务器上检查身份验证的cookie中。

I hope it helps.我希望它有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM