Search in sources :

Example 1 with WebDelegatingSubject

use of org.apache.shiro.web.subject.support.WebDelegatingSubject in project shiro by apache.

the class DefaultWebSubjectFactory method createSubject.

public Subject createSubject(SubjectContext context) {
    if (!(context instanceof WebSubjectContext)) {
        return super.createSubject(context);
    }
    WebSubjectContext wsc = (WebSubjectContext) context;
    SecurityManager securityManager = wsc.resolveSecurityManager();
    Session session = wsc.resolveSession();
    boolean sessionEnabled = wsc.isSessionCreationEnabled();
    PrincipalCollection principals = wsc.resolvePrincipals();
    boolean authenticated = wsc.resolveAuthenticated();
    String host = wsc.resolveHost();
    ServletRequest request = wsc.resolveServletRequest();
    ServletResponse response = wsc.resolveServletResponse();
    return new WebDelegatingSubject(principals, authenticated, host, session, sessionEnabled, request, response, securityManager);
}
Also used : ServletRequest(javax.servlet.ServletRequest) ServletResponse(javax.servlet.ServletResponse) SecurityManager(org.apache.shiro.mgt.SecurityManager) PrincipalCollection(org.apache.shiro.subject.PrincipalCollection) WebSubjectContext(org.apache.shiro.web.subject.WebSubjectContext) Session(org.apache.shiro.session.Session) WebDelegatingSubject(org.apache.shiro.web.subject.support.WebDelegatingSubject)

Aggregations

ServletRequest (javax.servlet.ServletRequest)1 ServletResponse (javax.servlet.ServletResponse)1 SecurityManager (org.apache.shiro.mgt.SecurityManager)1 Session (org.apache.shiro.session.Session)1 PrincipalCollection (org.apache.shiro.subject.PrincipalCollection)1 WebSubjectContext (org.apache.shiro.web.subject.WebSubjectContext)1 WebDelegatingSubject (org.apache.shiro.web.subject.support.WebDelegatingSubject)1