本文主要介绍下 kafka 0.10.0 版如何实现sasl/plain认证机制及权限控制
kakfa 的安全机制主要分为两部分:
- 身份认证(Authentication): 对客户端的身份进行认证
- 权限控制(Authorization): 对topic级别的权限进行控制
kafka 目前支持 SSL,SASL(Kerberos),SASL(PLAIN) 三种认证机制。
| package com.best.buc.base.manager.serialnum.generator.seq; | |
| import org.apache.commons.lang.ArrayUtils; | |
| import java.util.Collections; | |
| import java.util.List; | |
| import java.util.stream.Collectors; | |
| import java.util.stream.IntStream; | |
| /** |
| import com.google.common.geometry.{MutableInteger, S2CellId} | |
| /** | |
| * Created by fuyun on 2017/7/25. | |
| */ | |
| object ImproveS2 { | |
| val level = 17 | |
| // at level 17 | |
| def cellIj(cell: S2CellId): (Int, Int) = { | |
| val i = new MutableInteger(0) |
| package com.fuyun.scala; | |
| import java.io.IOException; | |
| import java.net.InetSocketAddress; | |
| import java.nio.ByteBuffer; | |
| import java.nio.CharBuffer; | |
| import java.nio.channels.SelectionKey; | |
| import java.nio.channels.Selector; | |
| import java.nio.channels.ServerSocketChannel; | |
| import java.nio.channels.SocketChannel; |