小编the*_*mar的帖子

未找到 ClientRegistrationRepository Bean

我正在尝试使用 Spring Boot 配置 OAuth2 客户端。我有以下依赖项:

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-webflux</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-oauth2-client</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-oauth2-jose</artifactId>
    </dependency>
Run Code Online (Sandbox Code Playgroud)

我已将这些属性添加到我的 application.yaml 中:

  security:
    oauth2:
      client:
        registration:
          azure:
            client-id: ****
            client-secret: ****
            authorization-grant-type: client_credentials
        provider:
          azure:
            authorization-uri: https://login.microsoftonline.com/2fdb7e27-9b62-44f7-a0fe-9836eaa1f161/oauth2/v2.0/authorize
            token-uri: https://login.microsoftonline.com/2fdb7e27-9b62-44f7-a0fe-9836eaa1f161/oauth2/v2.0/token
            jwk-set-uri: https://login.microsoftonline.com/2fdb7e27-9b62-44f7-a0fe-9836eaa1f161/discovery/v2.0/keys
Run Code Online (Sandbox Code Playgroud)

据我从 Spring 文档中了解到,这应该足以自动配置 ClientRegistrationRepository (“Spring Boot 2.x 自动配置将 spring.security.oauth2.client.registration.[registrationId] 下的每个属性绑定到自动配置还会将 ClientRegistrationRepository 注册为 ApplicationContext 中的 @Bean,以便在应用程序需要时可用于依赖项注入。 。

我有以下代码:

package com.sky.bnc.azurespring

import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.security.oauth2.client.OAuth2AuthorizedClientManager
import org.springframework.security.oauth2.client.OAuth2AuthorizedClientProviderBuilder
import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository
import org.springframework.security.oauth2.client.web.DefaultOAuth2AuthorizedClientManager
import org.springframework.security.oauth2.client.web.OAuth2AuthorizedClientRepository
import org.springframework.security.oauth2.client.web.reactive.function.client.ServletOAuth2AuthorizedClientExchangeFilterFunction
import …
Run Code Online (Sandbox Code Playgroud)

java oauth-2.0 azure-active-directory spring-boot spring-security-oauth2

9
推荐指数
1
解决办法
2万
查看次数

Kubernetes 卷挂载权限对于 Secret 不正确

我正在挂载一个 k8s 机密作为卷挂载,并且 pod 中的文件具有错误的权限。

在我Deploymentvolumes数组中有这个条目:

        - name: ssh-host-keys
          secret:
            secretName: ftp-ssh-host-keys
            defaultMode: 0600
Run Code Online (Sandbox Code Playgroud)

然后像这样安装:

            - mountPath: /etc/ssh/ssh_host_rsa_key
              name: ssh-host-keys
              subPath: ssh_host_rsa_key
              readOnly: true
Run Code Online (Sandbox Code Playgroud)

但是,当我查看Pod文件权限中的文件时:

rw-r--r-- 1 root root 553122 Aug 21  2018 moduli
-rw-r--r-- 1 root root   1723 Aug 21  2018 ssh_config
-rw-r----- 1 root 1337    410 May 11 10:33 ssh_host_ed25519_key
-rw-r----- 1 root 1337   3242 May 11 10:33 ssh_host_rsa_key
-rw-r--r-- 1 root 1337    465 May 11 10:33 sshd_config
Run Code Online (Sandbox Code Playgroud)

即密钥具有权限 0644 而不是 0600。 …

kubernetes kubernetes-secrets

6
推荐指数
2
解决办法
2956
查看次数

Docker 无法连接到使用 localhost:5000 推送到本地注册表

我正在关注 Docker 页面以运行本地注册表 ( https://docs.docker.com/registry/deploying/#run-a-local-registry )。注册表容器正在运行,但是当我尝试执行docker push localhost:5000/nginx此操作时出现此错误:

Get https://localhost:5000/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
Run Code Online (Sandbox Code Playgroud)

但是,我可以使用docker push 127.0.0.1:5000/nginx.

关于为什么这不起作用的任何建议?

编辑:

这是我的 /etc/resolve.conf

domain bskyb.com
nameserver 172.20.220.26
nameserver 172.20.220.25
nameserver 10.5.212.21
Run Code Online (Sandbox Code Playgroud)

我运行的命令:

[mwa51@OSTML0253700 ~] 2018-01-17 16:16:08$ docker push localhost:5000/nginx
The push refers to repository [localhost:5000/nginx]
Get https://localhost:5000/v2/: net/http: request canceled while 
waiting for connection (Client.Timeout exceeded while awaiting headers)
[mwa51@OSTML0253700 ~] 2018-01-17 16:16:31$

[mwa51@OSTML0253700 ~] 2018-01-17 16:16:31$ docker push 127.0.0.1:5000/nginx …
Run Code Online (Sandbox Code Playgroud)

docker docker-registry

5
推荐指数
0
解决办法
1043
查看次数

在docker中运行的热重载java程序

我开发了一个应该在docker中运行的java程序。但是,我在调试运行在 docker 中的 java 程序时遇到了很多麻烦。

网上查了一下,有些教程提出了spring-dev-tools之类的工具(因为我的java程序是基于spring-boot的程序)。

https://www.youtube.com/watch?v=sz5Zv5QQ5ek

根据这些教程,调试是可以的,例如设置断点和变量监视,但是,当我更新我的代码(例如,某些类)时,这些更改无法立即反映在 docker 中运行的程序中,程序表现得像旧代码。

有人可以给一些提示吗?

java docker spring-boot

5
推荐指数
1
解决办法
3012
查看次数

为什么我的服务间流量显示在 Kiali 的直通集群中

我有两个 Istio 集群,使用复制的控制平面并运行 Kiali。在每个集群中,我有两个交互的应用程序,但我在 Kiali 仪表板中看不到它们之间的流量。相反,流量显示为通过直通集群。

应用程序使用 kubernetes 服务名称进行交互,并且它们交互正确,只是在 Kiali 中没有正确显示。

对于可能出现的问题有什么想法吗?或者这是预期的行为(我对 Istio 还是新手)。

kubernetes istio kiali

3
推荐指数
1
解决办法
1万
查看次数