小编Ros*_*iet的帖子

多个资源服务器oauth2客户端?Spring OAuth2 SSO

美好的一天,

我已经设置了一个实现SSO和API网关模式的工作示例(类似于此处描述的https://spring.io/guides/tutorials/spring-security-and-angular-js/#_the_api_gateway_pattern_angular_js_and_spring_security_part_iv).

该系统由单独的服务器组件组成:AUTH-SERVER,API-GATEWAY,SERVICE-DISCOVERY,RESOURCE/UI SERVER.

在API-GATEWAY(使用Spring Boot @EnableZuulProxy @ EnableOAuth2Sso实现)我已经配置了多个OAuth提供程序,包括使用JWT的我自己的OAuth服务器:

security:
  oauth2:
    client:
      accessTokenUri: http://localhost:9999/uaa/oauth/token
      userAuthorizationUri: http://localhost:9999/uaa/oauth/authorize
      clientId: acme
      clientSecret: acmesecret
      redirectUri: http://localhost:9000/login
  resource:
    jwt:
      key-value: |
      -----BEGIN PUBLIC KEY-----
      ...public-key...
      -----END PUBLIC KEY-----

facebook:
  client:
    clientId: 233668646673605
    clientSecret: 33b17e044ee6a4fa383f46ec6e28ea1d
    accessTokenUri: https://graph.facebook.com/oauth/access_token
    userAuthorizationUri: https://www.facebook.com/dialog/oauth
    tokenName: oauth_token
    authenticationScheme: query
    clientAuthenticationScheme: form
    redirectUri: http://localhost:8080
  resource:
    userInfoUri: https://graph.facebook.com/me

github:
  client:
    clientId: bd1c0a783ccdd1c9b9e4
    clientSecret: 1a9030fbca47a5b2c28e92f19050bb77824b5ad1
    accessTokenUri: https://github.com/login/oauth/access_token
    userAuthorizationUri: https://github.com/login/oauth/authorize
    clientAuthenticationScheme: form
  resource:
    userInfoUri: https://api.github.com/user

google:
  client:
    clientId: 1091750269931-152sv64o8a0vd5hg8v2lp92qd2d4i00r.apps.googleusercontent.com
    clientSecret: n4I4MRNLKMdv603SU95Ic9lJ
    accessTokenUri: https://www.googleapis.com/oauth2/v3/token
    userAuthorizationUri: …
Run Code Online (Sandbox Code Playgroud)

oauth spring-boot spring-security-oauth2 spring-cloud spring-oauth2

6
推荐指数
0
解决办法
3615
查看次数

Spring Shell - 命令提示符立即退出,不等待用户输入

我正在尝试构建一个 Spring Shell 应用程序。我能够成功运行我的应用程序,但它会立即退出@启动并且不等待用户输入。JLineShell promptLoop 方法中似乎没有保留。

我正在用 mainClassName = "org.springframework.shell.Bootstrap" 构建一个 jar。

我的 spring-shell-plugin.xml 如下:

<?xml version="1.0" encoding="UTF-8"?>
 <beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="
     http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">

 <context:component-scan base-package="com.zailab" />

</beans>
Run Code Online (Sandbox Code Playgroud)

我的主课:

public class Main {

public static void main(String[] args) throws IOException{
    Bootstrap.main(args);
}

}
Run Code Online (Sandbox Code Playgroud)

我的命令类:

@Component
public class BuildCommand implements CommandMarker {

@CliAvailabilityIndicator({"echo"})
  public boolean isCommandAvailable() {
    return true;
  }

@CliCommand(value = "echo", help = "Echo a message")
 public String echo(
   @CliOption(key = { "", "msg" }, mandatory …
Run Code Online (Sandbox Code Playgroud)

java spring command-line-interface spring-shell

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