由于未满足PendencyException,带Okta的JHipster应用程序无法启动
添加OKTA配置后启动JHipster网关应用程序时出现以下错误:由于未满足PendencyException,带Okta的JHipster应用程序无法启动,jhipster,okta,jhipster-gateway,Jhipster,Okta,Jhipster Gateway,添加OKTA配置后启动JHipster网关应用程序时出现以下错误: $ cd saathratrigateway $ ./mvnw ... 2020-11-13 22:31:16.278 WARN 80043 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attem
$ cd saathratrigateway
$ ./mvnw
...
2020-11-13 22:31:16.278 WARN 80043 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'authorizationHeaderUtil' defined in file [/Users/amar/workspace/saathratri-app-holder/saathratrigateway/target/classes/com/saathratri/security/oauth2/AuthorizationHeaderUtil.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.security.oauth2.client.OAuth2AuthorizedClientService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
2020-11-13 22:31:16.280 DEBUG 80043 --- [ restartedMain] c.e.c.E.saathratri.domain.Authority : Close successful.
2020-11-13 22:31:16.281 DEBUG 80043 --- [ restartedMain] c.e.c.E.saathratri.domain.User : Close successful.
2020-11-13 22:31:16.281 DEBUG 80043 --- [ restartedMain] c.e.c.E.s.domain.User.authorities : Close successful.
2020-11-13 22:31:16.282 DEBUG 80043 --- [ restartedMain] c.ehcache.core.Ehcache-usersByEmail : Close successful.
2020-11-13 22:31:16.282 DEBUG 80043 --- [ restartedMain] c.ehcache.core.Ehcache-usersByLogin : Close successful.
2020-11-13 22:31:16.479 ERROR 80043 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 0 of constructor in com.saathratri.security.oauth2.AuthorizationHeaderUtil required a bean of type 'org.springframework.security.oauth2.client.OAuth2AuthorizedClientService' that could not be found.
The following candidates were found but could not be injected:
- Bean method 'authorizedClientService' in 'OAuth2WebSecurityConfiguration' not loaded because @ConditionalOnBean (types: org.springframework.security.oauth2.client.registration.ClientRegistrationRepository; SearchStrategy: all) did not find any beans of type org.springframework.security.oauth2.client.registration.ClientRegistrationRepository
Action:
Consider revisiting the entries above or defining a bean of type 'org.springframework.security.oauth2.client.OAuth2AuthorizedClientService' in your configuration.
如果您有任何建议,我们将不胜感激。好的-我想好了。我必须创建~/.okta.env,然后运行source~/.okta.env。见下文
$ vi ~/.okta.env
---
export SPRING_SECURITY_OAUTH2_CLIENT_PROVIDER_OIDC_ISSUER_URI="https://dev-XXXXXXX.okta.com/oauth2/default"
export SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_OIDC_CLIENT_ID="XXXXXXXXXXXXXXXXXXXX"
export SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_OIDC_CLIENT_SECRET="XXXXXX-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
export OKTA_OAUTH2_ISSUER="https://dev-XXXXXXX.okta.com/oauth2/default"
export OKTA_OAUTH2_CLIENT_ID_WEB="XXXXXXXXXXXXXXXXXXXX"
export OKTA_OAUTH2_CLIENT_SECRET_WEB="XXXXXX-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
---
$ source ~/.okta.env
$ cd saathratrigateway
$ ./mvnw
我是按照他的指示做的
谢谢马特·雷布尔
排灯节快乐。对不起,没有sudo也行。我修改了答案。非常感谢。我很高兴看到你明白了!谢谢你,马特!