Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/358.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在没有身份验证的情况下打开我的应用程序j hipster_Java_Spring Security_Jwt_Jhipster_Spring Security Oauth2 - Fatal编程技术网

Java 如何在没有身份验证的情况下打开我的应用程序j hipster

Java 如何在没有身份验证的情况下打开我的应用程序j hipster,java,spring-security,jwt,jhipster,spring-security-oauth2,Java,Spring Security,Jwt,Jhipster,Spring Security Oauth2,我已经创建了名为Bookstore的j hipster应用程序。运行我的应用程序后,它将进行身份验证。我不需要此身份验证。如果有任何方法可以在没有j hipster登录页面的情况下打开我的应用程序?假设您要构建一个保留JHipster管理功能的应用程序: 删除要公开的HTML元素的*jhiHasAnyAuthorities指令 处理isAuthenticated()的*ngSwitch指令也是如此,请参阅 路径“app/config”中有类MicroserviceSecurityConfigu

我已经创建了名为Bookstore的j hipster应用程序。运行我的应用程序后,它将进行身份验证。我不需要此身份验证。如果有任何方法可以在没有j hipster登录页面的情况下打开我的应用程序?

假设您要构建一个保留JHipster管理功能的应用程序:

  • 删除要公开的HTML元素的
    *jhiHasAnyAuthorities
    指令
  • 处理isAuthenticated()的*ngSwitch指令也是如此,请参阅
路径“app/config”中有类MicroserviceSecurityConfiguration.class 在这种情况下,在此处更改权限

(“/api/**”).Authenticated()

为了

(“/api/**”).permitAll()


要禁用身份验证,请执行以下操作:

  • 将SecurityConfiguration.java中的
    .antMatchers(“/api/**”).authenticated()
    替换为
    .antMatchers(“/**”).permitAll()
  • 从所有*.html文件中删除所有
    *.jhiHasAnyAuthority
    文件中的所有*.html指令
  • 从所有*.html中删除
    [ngSwitch]=“isAuthenticated()
    的所有指令及其
    *ngSwitchCase
  • 在所有*service.ts文件中的所有
    checkLogin(
    方法)中返回true
  • 请参阅有关授权的文档
  • 我希望它更容易

在较新的JHipster版本中,此更改应在config/SecurityConfiguration.java类生成中完成。如果您只想打开特定http方法的部分api,如能够获得未经验证的实体列表,请查看antMatchers(httpMethod,path)