类 WebSocketAuthenticationHandshakeInterceptor
java.lang.Object
cn.herodotus.engine.message.websocket.interceptor.WebSocketAuthenticationHandshakeInterceptor
- 所有已实现的接口:
org.springframework.web.socket.server.HandshakeInterceptor
public class WebSocketAuthenticationHandshakeInterceptor
extends Object
implements org.springframework.web.socket.server.HandshakeInterceptor
Description: WebSocketSessionHandshakeInterceptor
不是开启websocket的必要步骤,根据自身的业务逻辑决定是否添加拦截器
当前主要处理 Token 获取,以及 Token 的验证。如果验证成功,使用返回的用户名进行下一步,如果验证失败返回 false 终止握手。
- 作者:
- : gengwei.zheng
- Date:
- : 2022/12/4 21:34
-
构造器概要
构造器构造器说明WebSocketAuthenticationHandshakeInterceptor(cn.herodotus.engine.assistant.core.definition.BearerTokenResolver bearerTokenResolver) -
方法概要
修饰符和类型方法说明voidafterHandshake(org.springframework.http.server.ServerHttpRequest request, org.springframework.http.server.ServerHttpResponse response, org.springframework.web.socket.WebSocketHandler wsHandler, Exception ex) booleanbeforeHandshake(org.springframework.http.server.ServerHttpRequest request, org.springframework.http.server.ServerHttpResponse response, org.springframework.web.socket.WebSocketHandler wsHandler, Map<String, Object> attributes)
-
构造器详细资料
-
WebSocketAuthenticationHandshakeInterceptor
public WebSocketAuthenticationHandshakeInterceptor(cn.herodotus.engine.assistant.core.definition.BearerTokenResolver bearerTokenResolver)
-
-
方法详细资料
-
beforeHandshake
public boolean beforeHandshake(org.springframework.http.server.ServerHttpRequest request, org.springframework.http.server.ServerHttpResponse response, org.springframework.web.socket.WebSocketHandler wsHandler, Map<String, Object> attributes) throws Exception- 指定者:
beforeHandshake在接口中org.springframework.web.socket.server.HandshakeInterceptor- 抛出:
Exception
-
afterHandshake
public void afterHandshake(org.springframework.http.server.ServerHttpRequest request, org.springframework.http.server.ServerHttpResponse response, org.springframework.web.socket.WebSocketHandler wsHandler, Exception ex) - 指定者:
afterHandshake在接口中org.springframework.web.socket.server.HandshakeInterceptor
-