Shiro SessionsSecurityManager设计概念

SessionsSecurityManager

SessionsSecurityManager的具体行为就是实现SessionManager的抽象行为

SessionManager

public interface SessionManager {

    // 创建Session
    Session start(SessionContext context);

    // 根据SessionKey获得Session
    Session getSession(SessionKey key) throws SessionException;
}

SessionsSecurityManager内置了一个SessionManager会员管理器

public Session start(SessionContext context) throws AuthorizationException {
    return this.sessionManager.start(context);
}

public Session getSession(SessionKey key) throws SessionException {
    return this.sessionManager.getSession(key);
}

其设计理念是实现会员管理器接口,又用会员管理器去具体实现其定义的行为。

猜你喜欢

转载自www.cnblogs.com/BINGJJFLY/p/9259713.html