介绍 Spring Shell 2.0M1!

发布 | Eric Bottard | 2017年9月18日 | ...

我们很高兴地宣布 Spring Shell 2.x 的第一个里程碑版本!

历时两年打造的 Spring Shell 2 是 Spring Shell 的一次彻底重写,利用了更新的组件(如 JLine 3)并应用了更好的模块化。Spring Shell 2 也考虑到 Spring Boot,利用了自动配置和其他 Boot 特性。

内部架构现在使用可插拔模型来发现哪些方法可以转换为命令,如何将用户输入解析为参数值,以及如何处理返回值。这与 Spring MVC 等采用的方法非常相似,并允许以以前不可能的方式扩展框架。Spring Shell 的用户通常无需关心这些,只需使用新的“标准”命令 API

Spring Security 5.0.0 M4 发布

发布 | Rob Winch | 2017年9月15日 | ...

我谨代表社区,很高兴宣布发布 Spring Security 5.0.0 M4。此版本包括错误修复、新功能,并基于 Spring Framework 5.0.0 RC4。您可以在更新日志中找到完整的详细信息。此版本的亮点包括

OAuth2 / OIDC

OAuth2 登录 Java 配置

HttpSecurity.oauth2Login() DSL 有多项改进。

您现在可以使用自定义的 AuthorizationGrantTokenExchangerSecurityTokenRepository<AccessToken> 实现配置 Token Endpoint,如下所示

protected void configure(HttpSecurity http) throws Exception {
  http
    .authorizeRequests()
      .anyRequest().authenticated()
      .and()
    .oauth2Login()
      .tokenEndpoint()
        .authorizationCodeTokenExchanger(this.authorizationCodeTokenExchanger())
	.accessTokenRepository(this.accessTokenRepository());
}

我们还增加了自定义 Authorization EndpointRedirection Endpoint 请求路径的功能

protected void configure(HttpSecurity http) throws Exception {
  http
    .authorizeRequests()
      .anyRequest().authenticated()
      .and()
    .oauth2Login()
      .authorizationEndpoint()
        .requestMatcher(new AntPathRequestMatcher("/custom-path/{clientAlias}"))
        .and()
      .redirectionEndpoint()
        .requestMatcher(new AntPathRequestMatcher("/custom-path/callback/{clientAlias}"));
}

与 Spring Security 中的所有 AbstractAuthenticationProcessingFilter 一样,您还可以设置自定义的 AuthenticationSuccessHandlerAuthenticationFailureHandler

protected void configure(HttpSecurity http) throws Exception {
  http
    .authorizeRequests()
      .anyRequest().authenticated()
      .and()
     .oauth2Login()
       .successHandler(this.customAuthenticationSuccessHandler())
       .failureHandler(this.customAuthenticationFailureHandler());
}

安全令牌仓库

我们引入了 SecurityTokenRepository<T extends SecurityToken> 抽象,负责持久化 SecurityToken

初始实现 InMemoryAccessTokenRepository 提供了 AccessToken 的持久化。在即将发布的版本中,我们还将提供一个支持持久化 Refresh Token 的实现。

ID Token 和 Claims

IdToken 引入了一些小的改进,同时完成了 JwtClaimAccessorStandardClaimAccessorIdTokenClaimAccessor 的最终实现细节,这些类提供了方便地访问其相关构造(例如 JwtIdTokenUserInfo)中的 claims 的功能。

授权请求改进

我们增加了 AuthorizationRequestRepositoryAuthorization Request 持久化到 Cookie 的能力。当前的默认实现是持久化到 HttpSession,但是可以提供自定义实现来持久化到 Cookie

对于 AuthorizationCodeRequestRedirectFilter 中配置在 redirect-uri 中的 URI 变量也增加了支持。

OAuth2 客户端属性

用于配置 OAuth 2.0 客户端的属性有一些小的更新。下面的配置概述了当前的结构。您会注意到支持配置多个客户端,例如 google、github、okta 等。

security:
  oauth2:
    client:
      google:
        client-id: your-app-client-id
        client-secret: your-app-client-secret
        client-authentication-method: basic
        authorization-grant-type: authorization_code
        redirect-uri: "{scheme}://{serverName}:{serverPort}{contextPath}/oauth2/authorize/code/{clientAlias}"
        scope: openid, profile, email, address, phone
        authorization-uri: "https://#/o/oauth2/v2/auth"
        token-uri: "https://www.googleapis.com/oauth2/v4/token"
        user-info-uri: "https://www.googleapis.com/oauth2/v3/userinfo"
        user-name-attribute-name: "sub"
        jwk-set-uri: "https://www.googleapis.com/oauth2/v3/certs"
        client-name: Google
        client-alias: google
      github:
        ...
      okta:
        ...

在 Spring Security 示例的 oauth2login 中可以找到使用新的 Spring Security OAuth 2.0 / OpenID Connect 1.0 登录功能的完整示例。本指南将引导您完成设置示例应用程序以使用外部 OAuth 2.0 或 OpenID Connect 1.0 Provider 进行 OAuth 2.0 登录的步骤。

响应式安全

响应式方法安全

Spring Security 的响应式支持现在通过利用 Reactor 的 Context 包括了方法安全性。亮点如下,您可以在 samples/javaconfig/hellowebflux-method 中找到一个完整的示例。

第一步是使用 @EnableReactiveMethodSecurity 来启用对 @PreAuthorize@PostAuthorize 注解的支持。此步骤确保对象被正确代理。

@EnableWebFluxSecurity
@EnableReactiveMethodSecurity
public class SecurityConfig {

下一步是创建一个使用 @PreAuthorize@PostAuthorize 注解的服务。例如

@PreAuthorize("hasRole('ADMIN')")
public Mono<String> findMessage() {

Spring Security 的 WebFlux 支持将确保 Reactor Context 中填充当前用户,该用户用于确定是否授予或拒绝访问权限。

Spring Security 的标准 @WithMockUser相关注解 已更新,以与响应式方法安全性一起使用。例如

@RunWith(SpringRunner.class)
// ...
public class HelloWorldMessageServiceTests {
  @Autowired
  HelloWorldMessageService messages;

@Test public void messagesWhenNotAuthenticatedThenDenied() { StepVerifier.create(this.messages.findMessage()) .expectError(AccessDeniedException.class) .verify(); }

@Test @WithMockUser public void messagesWhenUserThenDenied() { StepVerifier.create(this.messages.findMessage()) .expectError(AccessDeniedException.class) .verify(); }

@Test @WithMockUser(roles = "ADMIN") public void messagesWhenAdminThenOk() { StepVerifier.create(this.messages.findMessage()) .expectNext("Hello World!") .verifyComplete(); } }

测试支持也与 TestWebClient 很好地配合工作。例如

@RunWith(SpringRunner.class)
// ...
public class HelloWebfluxMethodApplicationTests {
  @Autowired
  ApplicationContext context;

WebTestClient rest;

@Before public void setup() { this.rest…

Spring Session 2.0.0 M4

发布 | Rob Winch | 2017年9月15日 | ...

我谨代表社区,很高兴宣布发布 Spring Session 2.0.0.M4。此版本主要侧重于完善 WebFlux 支持。亮点包括

简化的 WebFlux 配置

为 WebFlux 配置 Spring Session 得到简化

@Configuration
@EnableSpringWebSession
public class HelloWebfluxSessionConfig {

  @Bean
  public MapReactorSessionRepository reactorSessionRepository() {
    return new MapReactorSessionRepository(new ConcurrentHashMap<>());
  }
}

您还可以通过简单地添加一个 WebSessionIdResolver Bean 来切换解析会话 ID 的策略。例如,要将会话 ID 的解析方式从使用 cookie 切换到使用头部,您可以使用 Spring Framework 新的 HeaderWebSessionIdResolver

Spring Boot 2.0.0 M4 现已可用

发布 | Stéphane Nicoll | 2017年9月15日 | ...

紧随最新的 Spring Framework 5 发布候选版之后,Spring Boot 2.0 M4 现已可从我们的里程碑仓库获取。此版本解决了 150 个问题和拉取请求,是迈向 2.0 GA 的重要一步。感谢所有贡献者!

此里程碑版本提供了一系列小的调整和增强功能,以及三个主要更改

有关完整的更改列表和升级说明,请参阅 WIKI 上的 Spring Boot 2.0.0.M4 发布说明。我们在更新参考文档方面有些滞后,因此请考虑使用 snapshot 版本

Spring Cloud Stream Ditmars/1.3 发布候选版公告

发布 | Gary Russell | 2017年9月14日 | ...

我们很高兴宣布发布候选版 Spring Cloud Stream Ditmars.RC1 现已可在Spring Milestone 仓库中使用。发布说明包含与 Spring Boot、Spring Cloud、Spring AMQP 和 Spring for Apache Kafka 版本兼容性的相关信息。

适用于 Apache Kafka 的 Kafka Streams

此版本旨在将 适用于 Apache Kafka 的 Kafka Streams 支持提升为 Apache Kafka 绑定器实现中的顶级项目。随着适用于 Apache Kafka 的 Kafka Streams 被定位为一等公民,开发人员现在可以通过以下方式构建 Spring Cloud Stream 应用程序…

Spring Integration 5.0 里程碑 7 和 4.3.12 现已可用

发布 | Artem Bilan | 2017年9月14日 | ...

我谨代表 Spring Integration 团队,很高兴宣布 Spring Integration 5.0 版本 (5.0.0.M7) 的里程碑 7 现已可用。

可从里程碑仓库下载

repositories {
    maven { url 'http://repo.spring.io/libs-milestone' }
}
compile "org.springframework.integration:spring-integration-core:5.0.0.M7"

21 个 JIRA(以及一些 GitHub 问题)已包含在此版本中,包括错误修复和许多新功能。自上次发布的里程碑 6 以来,M7 中的一些功能亮点包括

  • 响应式 WebFlux Channel Adapters 已提取到单独的 spring-integration-webflux 模块中,以区分基于 Servlet 的 MVC 配置和响应式基础。

  • 引入了 EmbeddedJsonHeadersMessageMapper,以便将消息头部与负载一起嵌入到目标协议的包中,这些协议原生不支持头部,例如 TCP/IP、MQTT、AWS Kinesis 和 0.11.x 版本之前的 Apache Kafka。

  • java.util.function.Supplier 现在可以充当 MessageSource

Spring AMQP 2.0 发布候选版、1.7.4 和 1.6.11 现已可用

发布 | Gary Russell | 2017年9月12日 | ...

我很高兴宣布 Spring AMQP 的 2.0.0.RC1 发布候选版现已在Spring 里程碑仓库中可用。

此版本在最终里程碑里程碑 5 的基础上增加了一些小的修复/改进。

感谢所有社区成员的反馈和贡献!

GA 版本将在 Spring Framework 5.0 GA 版本于 9 月发布后不久发布。

有关 2.0 中的完整更改列表,请参阅参考手册中的新增内容

维护版本 1.7.41.6.11 也已可用。

项目页面 | JIRA | 贡献 | 帮助 | 聊天

Spring For Apache Kafka 2.0 和 1.3 发布候选版现已可用

发布 | Gary Russell | 2017年9月12日 | ...

我们很高兴宣布 Spring for Apache Kafka 2.0 版本的 2.0.0.RC1 发布候选版现已可用。

正如在1.3.0.M2 公告中所讨论的,我们正在同时发布 1.3 和 2.0 版本,其中 1.3 包含 2.0 功能的子集,支持 Kafka 0.11.x.x 客户端,同时仍然支持 Spring Framework 4.3。因此,1.3.0.RC1 发布候选版也已可用。

可从里程碑仓库下载

repositories {
    maven { url 'http://repo.spring.io/libs-milestone' }
}
compile "org.springframework.kafka:spring-kafka:2.0.0.RC1"

自上次公告以来,以下是摘要…

Spring Boot 1.5.7 现已可用

发布 | Brian Clozel | 2017年9月12日 | ...

我谨代表团队,很高兴宣布 Spring Boot 1.5.7 已发布,现可从 repo.spring.ioMaven Central 获取。

Spring Boot 1.5.7 包括 51 个修复、改进和依赖更新。感谢所有提交问题报告和拉取请求的贡献者。

接下来是什么?

Spring Framework 5.0 RC4 刚刚发布,其他 Spring 项目也将陆续发布。Spring Boot 2.0 M4 即将到来,这将是测试 Spring Framework GA 之前的最后一个发布候选版 的好方法。如果您想提前体验 Spring Boot 2,并且如果您愿意,我们很乐意听取您的反馈,请访问 start.spring.io 并选择 Spring Boot 2.0.0.BUILD-SNAPSHOT

订阅 Spring 新闻稿

通过 Spring 新闻稿保持联系

订阅

领先一步

VMware 提供培训和认证,助您加速进步。

了解更多

获取支持

Tanzu Spring 通过一份简单的订阅提供 OpenJDK™、Spring 和 Apache Tomcat® 的支持和二进制文件。

了解更多

近期活动

查看 Spring 社区的所有近期活动。

查看全部