Axon 参考指南
  • 介绍
  • 架构概览
    • DDD & CQRS 概念
    • 事件溯源
    • 事件驱动的微服务
  • Axon Server
  • 发行说明
    • Axon Framework
      • Major Releases
      • Minor Releases
    • Axon Server
      • Major Releases
      • Minor Releases Standard Edition
      • Minor Releases Enterprise Edition
    • Axon Framework Extensions
      • AMQP
        • Major Releases
      • CDI
        • Major Releases
      • JGroups
        • Major Releases
      • Kafka
        • Major Releases
        • Minor Releases
      • Kotlin
        • Experimental Releases
      • Mongo
        • Major Releases
        • Minor Releases
      • Reactor
        • Major Releases
        • Minor Releases
      • Spring Cloud
        • Major Releases
        • Minor Releases
      • Tracing
        • Major Releases
        • Minor Releases
  • Getting Started
    • 快速开始
  • Axon Framework
    • 介绍
    • 消息传递概念
      • 消息剖析
      • 消息关联
      • 消息拦截
      • 支持带注解的处理程序
      • 异常处理
      • 工作单元
    • 命令
      • 建模
        • 聚合
        • 多实体聚合
        • 聚合状态存储
        • 从另一个聚合创建聚合
        • 聚合多态性
        • 解决冲突
      • 命令调度器
      • 命令处理程序
      • 基础设施
      • 配置
    • 事件
      • 事件调度器
      • 事件处理程序
      • 事件处理器
        • 订阅事件处理器
        • 流式事件处理器
      • 事件总线和事件存储
      • 事件版本控制
    • 查询
      • 查询处理
      • 查询调度器
      • 查询处理程序
      • 实现
      • 配置
    • 长时处理过程(Sagas)
      • 实现
      • 关联
      • 基础设施
    • Deadlines
      • Deadline Managers
      • Event Schedulers
    • 测试
      • 命令 / 事件
      • 长时处理过程(Sagas)
    • 序列化
    • 调整
      • 事件快照
      • 事件处理
      • 命令处理
    • 监控和指标
    • Spring Boot 集成
    • 模块
  • Axon Server
    • 介绍
    • 安装
      • 本地安装
        • Axon Server SE
        • Axon Server EE
      • Docker / K8s
        • Axon Server SE
        • Axon Server EE
    • 管理
      • 配置
        • System Properties
        • Command Line Interface
        • REST API
        • GRPC API
      • Monitoring
        • Actuator Endpoints
        • gRPC Metrics
        • Heartbeat Monitoring
      • Clusters
      • Replication Groups
      • Multi-Context
      • Tagging
      • Backup and Messaging-only Nodes
      • Backups
      • Recovery
      • Plugins
      • Error Codes
    • 安全
      • SSL
      • 访问控制
      • 访问控制 - 标准版
      • 访问控制 - 企业版
      • 访问控制 - 客户端应用程序
      • 访问控制 - 命令行
      • 访问控制 - REST API
      • 访问控制 - LDAP
      • 访问控制 - OAuth 2.0
    • 性能
      • 事件段
      • 流量控制
    • 迁移
      • Standard to Enterprise Edition
      • Non-Axon Server to Axon Server
  • Extensions
    • Spring AMQP
    • JGroups
    • Kafka
    • Kotlin
    • Mongo
    • Reactor
      • Reactor Gateways
    • Spring Cloud
    • Tracing
  • Appendices
    • A. RDBMS Tuning
    • B. Message Handler Tuning
      • 参数解析器
      • 处理程序增强
    • C. 元数据注解
    • D. 标识符生成
    • E. Axon Server Query Language
由 GitBook 提供支持
在本页
  • Installing the OAuth Extension
  • Configuring the OAuth Extension
  • Configuring the User's Access and Roles
  1. Axon Server
  2. 安全

访问控制 - OAuth 2.0

Access Control - OAuth 2.0

This extension will allow you to use OAuth2 integration (currently only with Google) for authentication in Axon Server. User accounts and roles from the OAuth provider are not synchronized to the Axon Server cluster, because no roles are associated with them. This means an account needs to be made in the cluster with the username from the provider, and roles assigned.

Installing the OAuth Extension

To install the OAuth Extension, you need to unpack the distribution ZIP-file, so the JAR files are in the "exts" subdirectory of the working directory of Axon Server:

$ mkdir exts
$ unzip -j axon-server-extension-oauth-4.5-SNAPSHOT-bin.zip -d exts
Archive:  axon-server-extension-oauth-4.5-SNAPSHOT-bin.zip
  inflating: exts/axon-server-extension-oauth-4.5-SNAPSHOT.jar
  inflating: exts/commons-compress-1.9.jar
  inflating: exts/commons-lang3-3.8.1.jar
  inflating: exts/content-type-2.1.jar
  inflating: exts/javax.inject-1.jar
  inflating: exts/javax.persistence-api-2.2.jar
  inflating: exts/javax.transaction-api-1.3.jar
  inflating: exts/jcip-annotations-1.0-1.jar
  inflating: exts/lang-tag-1.4.4.jar
  inflating: exts/nimbus-jose-jwt-9.1.3.jar
  inflating: exts/oauth2-oidc-sdk-8.23.1.jar
  inflating: exts/spring-boot-starter-oauth2-client-2.1.6.RELEASE.jar
  inflating: exts/spring-security-oauth2-client-5.1.5.RELEASE.jar
  inflating: exts/spring-security-oauth2-core-5.1.5.RELEASE.jar
  inflating: exts/spring-security-oauth2-jose-5.1.5.RELEASE.jar
  inflating: exts/tomcat-embed-el-9.0.21.jar
  inflating: exts/validation-api-2.0.1.Final.jar
$

Note that the actual version numbers may differ in your case.

Configuring the OAuth Extension

The options used are:

  • axoniq.axonserver.accesscontrol.enabled

    This must be set to "true" to enable access control.

  • axoniq.axonserver.enterprise.oauth2.enabled

    This must be set to "true" to enable the OAuth extension.

  • axoniq.axonserver.enterprise.oauth2.authorization-uri

    This optional value can be used to configure the URI that will trigger the authentication using OAuth2. The default value is "/oauth2/authorization" and should work fine.

  • spring.security.oauth2.client.registration.google.client-id

    This should be set to the client-id provided by the Google Developer Console where you registered the cluster.

  • spring.security.oauth2.client.registration.google.client-secret

    This should be set to the secret provided by the Google Developer Console where you registered the cluster.

  • spring.security.oauth2.client.registration.google.scope

    This setting is used to configure what information Google should share with the Axon Server cluster. A good value to use is "email", which will allow you to use the email address as username, as is common with Google accounts.

  • axoniq.axonserver.enterprise.oauth2.username-map.google

    This setting tells the extension what value to use as username and requires that this value is provided by Google using the "scope" setting described above. If the email address is to be used, as suggested above, the value should be "email".

  • axoniq.axonserver.enterprise.oauth2.request-params

    This setting defines a map of parameters to add to the redirect URL, to customize the behavior of the provider's integration. For Google, if the users use the same browser with multiple Google accounts, a good setting to add is "prompt", with value "select_account":

    axoniq.axonserver.enterprise.oauth2.request-params.prompt=select_account

    This will force Google to always ask which account must be used to continue, even if there is only a single account in use, and that account is currently active.

Configuring the User's Access and Roles

If a username is unknown in the Axon Server cluster, even when authentication succeeds, the user will not be allowed to log in. To allow this, a user with "ADMIN" level access needs to create a user, optionally without a password, and assign the roles for this user. The Axon Server CLI has a special options ("--no-password") to allow the creation of accounts without a password. Note that if you create an account with a password, this will allow the user to choose to use that rather than the OAuth integration.

上一页访问控制 - LDAP下一页性能

最后更新于2年前