无法从JHipster UAA获取OAUTH2令牌

无法从JHipster UAA获取OAUTH2令牌,jhipster,Jhipster,我用JHipster 5.1.0生成了一个UAA服务器。我选择PostgreSQL作为数据库类型 它连接到我的jhipster注册表,然后我生成了一个微服务和一个网关,如下所示: $ mkdir coherence-uaa && cd coherence-uaa $ yo jhipster ? Which *type* of application would you like to create? Microservice UAA service ? As you are ru

我用JHipster 5.1.0生成了一个UAA服务器。我选择PostgreSQL作为数据库类型

它连接到我的jhipster注册表,然后我生成了一个微服务和一个网关,如下所示:

$ mkdir coherence-uaa && cd coherence-uaa
$ yo jhipster
? Which *type* of application would you like to create? Microservice UAA service
? As you are running in a microservice architecture, on which port would like your server to run? It should be unique to avoid port conflicts. 9999
? What is your default Java package name? de.stytex.foobar
? Which *type* of database would you like to use? SQL (H2, MySQL, PostgreSQL, Oracle)
? Which *production* database would you like to use? PostgreSQL
? Which *development* database would you like to use? H2 with disk-based persistence
? Do you want to use Hibernate 2nd level cache? Hazelcast
? Do you want to use a search engine in your application? No
? Would you like to use Maven or Gradle for building the backend? Maven
? Would you like to enable internationalization support? Yes
? Please choose the native language of the application? English
? Please choose additional languages to install
? Which testing frameworks would you like to use?
[...]
$ ./mvnw

$ mkdir coherence-gateway && cd coherence-gateway
$ yo jhipster
? Which *type* of application would you like to create? Microservice gateway
? What is the base name of your application? gateway
? As you are running in a microservice architecture, on which port would like your server to run? It should be unique to avoid port conflicts. 8080
? What is your default Java package name? de.stytex.foobar
? Which service discovery server do you want to use? JHipster Registry (uses Eureka, provides Spring Cloud Config support and monitoring dashboards)
? Which *type* of authentication would you like to use? Authentication with JHipster UAA server (the server must be generated separately)
? What is the folder path of your UAA application? ../coherence-uaa
? Which *type* of database would you like to use? SQL (H2, MySQL, PostgreSQL, Oracle)
? Which *production* database would you like to use? PostgreSQL
? Which *development* database would you like to use? H2 with disk-based persistence
? Do you want to use Hibernate 2nd level cache? Hazelcast
? Do you want to use a search engine in your application? No
? Do you want to use clustered HTTP sessions? No
? Do you want to use WebSockets? No
? Would you like to use Maven or Gradle for building the backend? Gradle
? Would you like to use the LibSass stylesheet preprocessor for your CSS? No
? Would you like to enable internationalization support? Yes
? Please choose the native language of the application? English
? Please choose additional languages to install
? Which testing frameworks would you like to use?
[...]
./mvnw
启动用户登录网关后,无法获取访问令牌并引发错误:

2018-07-23 17:32:53.378调试7228---[XNIO-2任务-10]c.c.c.a.g.a.AccessControlFilter:访问控制:允许访问/coherence\uUAA/api/account,因为尚未为服务设置访问控制策略:coherence\uUAA

2018-07-23 17:32:54.599调试7228---[XNIO-2 task-12]c.c.c.a.g.a.AccessControlFilter:访问控制:允许访问/coherence\uaa/api/account,因为尚未为服务设置访问控制策略:coherence\uaa

2018-07-23 17:33:00.566调试7228---[XNIO-2 task-14]c.c.c.admin.aop.logging.LoggingAspect:Enter:com.crimsonlogic.coherence.admin.web.rest.AuthResource.authenticate(),参数[s]=[SecurityContextHolderAwareRequestWrapper[FirewalledRequest[HttpServletRequestImpl[POST/auth/login]],com.codahale.metrics.servlet.AbstractInstrumentedFilter$StatusExposingServletResponse@7101e809,{username=admin,password=admin}]

2018-07-23 17:33:00.576调试7228---[XNIO-2任务-14]c.a.s.o.OAuth2TokenEndpointClientAdapter:联系OAuth2令牌端点登录用户:admin

2018-07-23 17:33:00.588错误7228---[XNIO-2任务-14]c.c.c.a.s.o.OAuth2AuthenticationService:无法从UAA获取OAuth2令牌

java.lang.IllegalStateException:请求URI不包含有效的主机名:http://coherence\u uaa/oauth/token 位于org.springframework.util.Assert.state(Assert.java:73) 位于org.springframework.cloud.client.loadbalancer.RetryLoadBalancerInterceptor.intercept(RetryLoadBalancerInterceptor.java:63) 位于org.springframework.http.client.InterceptingClientHttpRequest$InterceptingRequestExecution.execute(InterceptingClientHttpRequest.java:92) 位于org.springframework.http.client.InterceptingClientHttpRequest.executeInternal(InterceptingClientHttpRequest.java:76) 位于org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48) 位于org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:53) 位于org.springframework.web.client.restemplate.doExecute(restemplate.java:723) 位于org.springframework.web.client.restemplate.execute(restemplate.java:680) 位于org.springframework.web.client.restemplate.postForEntity(restemplate.java:466) 在com.crimsonlogic.coherence.admin.security.oauth2.OAuth2TokenEndpointClientAdapter.sendPasswordGrant(OAuth2TokenEndpointClientAdapter.java:54) 位于com.crimsonlogic.coherence.admin.security.oauth2.OAuth2AuthenticationService.authenticate(OAuth2AuthenticationService.java:65)
在com.crimsonlogic.coherence.admin.web.rest.AuthResource.authenticate(AuthResource.java:51)

外部客户端的URI中的主机名不能包含下划线(如
coherence\u ua


有一个例子是,
\uu
受到微服务基本名称的限制,在UAAs中也应该受到限制

外部客户端的URI中的主机名不能包含下划线(如
coherence\u uaa


有一个例子是,
\uu
受到微服务基本名称的限制,在UAAs中也应该受到限制

我重新创建了名为“UAA”的UAA服务器,然后问题就解决了。在生成的网关中,名称“UAA”似乎是硬编码的。我仅使用名称“UAA”重新创建了UAA服务器,然后问题就解决了。似乎名称“UAA”是在生成的网关中硬编码的。