расшифровывать git пароль в config-сервере не работает - PullRequest
0 голосов
/ 24 февраля 2020

Я использую сервер конфигурации Spring Cloud. Я пытаюсь сохранить мой пароль git в зашифрованном виде в файле Applicayion.yml. Когда я запускаю свой сервер конфигурации, я получаю сообщение об ошибке «не авторизовано».

Я не понимаю, что вам действительно нужно для использования зашифрованного пароля. Я думал, что это работает из коробки. Я могу сделать / зашифровать en / decrypt по URL-адресу сервера конфигурации.

Если я использую пароль git в виде простого текста, он работает нормально.

Что я делаю неправильно? Какие зависимости вам нужны. Я также пытался поместить файлы JAR JAR, но это, похоже, не работает.

благодарю

Jon

Мой файл application.yml:

  spring:
   cloud:
    config:
      server:
        git:
          uri: <my-git-repo>
          username: my-username
          password: '{cypher}ce544e1c6754678b814c00080e622b6001a33194c45ba38351a40aa423c22f46'

мой файл boostrap.yml:

encrypt:
  key: mysecret

вот сообщение об ошибке

2020-02-24 13:12:28.969  INFO 6956 --- [           main] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@3b8ec001, org.springframework.security.web.context.SecurityContextPersistenceFilter@4e642ee1, org.springframework.security.web.header.HeaderWriterFilter@2489e84a, org.springframework.security.web.csrf.CsrfFilter@5e5aafc6, org.springframework.security.web.authentication.logout.LogoutFilter@338766de, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@2a43e0ac, org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter@4833eff3, org.springframework.security.web.authentication.ui.DefaultLogoutPageGeneratingFilter@1e95b653, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@6d8796c1, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@2fd954f, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@2676dc05, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@6f6c6077, org.springframework.security.web.session.SessionManagementFilter@62b93086, org.springframework.security.web.access.ExceptionTranslationFilter@41b13f3d, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@6d2a2560]
2020-02-24 13:12:30.221  INFO 6956 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 15 endpoint(s) beneath base path '/actuator'
2020-02-24 13:12:30.284  INFO 6956 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8888 (http) with context path ''
2020-02-24 13:12:30.869  INFO 6956 --- [           main] c.e.c.SpringCloudConfigServerApplication : Started SpringCloudConfigServerApplication in 5.161 seconds (JVM running for 5.998)
2020-02-24 13:12:31.349  INFO 6956 --- [on(1)-10.0.75.1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2020-02-24 13:12:31.349  INFO 6956 --- [on(1)-10.0.75.1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2020-02-24 13:12:31.353  INFO 6956 --- [on(1)-10.0.75.1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 4 ms
2020-02-24 13:12:33.567  WARN 6956 --- [on(2)-10.0.75.1] .c.s.e.MultipleJGitEnvironmentRepository : Error occured cloning to base directory.

org.eclipse.jgit.api.errors.TransportException: https://my-repo: not authorized
    at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:254) ~[org.eclipse.jgit-5.1.3.201810200350-r.jar:5.1.3.201810200350-r]
    at org.eclipse.jgit.api.CloneCommand.fetch(CloneCommand.java:306) ~[org.eclipse.jgit-5.1.3.201810200350-r.jar:5.1.3.201810200350-r]
    at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:200) ~[org.eclipse.jgit-5.1.3.201810200350-r.jar:5.1.3.201810200350-r]
    at org.springframework.cloud.config.server.environment.JGitEnvironmentRepository.cloneToBasedir(JGitEnvironmentRepository.java:589) [spring-cloud-config-server-2.2.1.RELEASE.jar:2.2.1.RELEASE]
    at org.springframework.cloud.config.server.environment.JGitEnvironmentRepository.copyRepository(JGitEnvironmentRepository.java:564) [spring-cloud-config-server-2.2.1.RELEASE.jar:2.2.1.RELEASE]
    at org.springframework.cloud.config.server.environment.JGitEnvironmentRepository.createGitClient(JGitEnvironmentRepository.java:547) [spring-cloud-config-server-2.2.1.RELEASE.jar:2.2.1.RELEASE]
...