Java Code Examples for org.apache.shiro.subject.SubjectContext#setSessionCreationEnabled()

The following examples show how to use org.apache.shiro.subject.SubjectContext#setSessionCreationEnabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JwtSubjectFactory.java    From jboot-admin with Apache License 2.0 5 votes vote down vote up
@Override
public Subject createSubject(SubjectContext context) {
    if (context.getAuthenticationToken() instanceof JwtAuthenticationToken) {
        // jwt 不创建 session
        context.setSessionCreationEnabled(false);
    }

    return super.createSubject(context);
}
 
Example 2
Source File: StatelessDefaultSubjectFactory.java    From parker with MIT License 5 votes vote down vote up
@Override
public Subject createSubject(SubjectContext context) {

    // 不创建session.
    context.setSessionCreationEnabled(false);
    return super.createSubject(context);

}
 
Example 3
Source File: JwtDefaultSubjectFactory.java    From zhcc-server with Apache License 2.0 5 votes vote down vote up
@Override
public Subject createSubject(SubjectContext context) {
    // 不创建session
    context.setSessionCreationEnabled(false);
    Subject subject = super.createSubject(context);
    return subject;
}
 
Example 4
Source File: JsetsSubjectFactory.java    From jsets-shiro-spring-boot-starter with Apache License 2.0 5 votes vote down vote up
public Subject createSubject(SubjectContext context) { 
	this.storageEvaluator.setSessionStorageEnabled(Boolean.TRUE);
	AuthenticationToken token = context.getAuthenticationToken();
	if(CommonUtils.isStatelessToken(token)){
        // 不创建 session 
        context.setSessionCreationEnabled(false);
        // 不持久化session
        this.storageEvaluator.setSessionStorageEnabled(Boolean.FALSE);
	}
    return super.createSubject(context); 
}
 
Example 5
Source File: StatelessSubjectFactory.java    From shiro-spring-boot-starter with Apache License 2.0 5 votes vote down vote up
@Override
public Subject createSubject(SubjectContext context) {
    // 不创建session
    context.setSessionCreationEnabled(false);

    return super.createSubject(context);
}
 
Example 6
Source File: StatelessWebSubjectFactory.java    From bootshiro with MIT License 4 votes vote down vote up
@Override
public Subject createSubject(SubjectContext context) {
    // 这里都不创建session
    context.setSessionCreationEnabled(Boolean.FALSE);
    return super.createSubject(context);
}
 
Example 7
Source File: AgileSubjectFactory.java    From watchdog-framework with MIT License 4 votes vote down vote up
@Override
public Subject createSubject(SubjectContext context) {
    context.setSessionCreationEnabled(false);
    return super.createSubject(context);
}
 
Example 8
Source File: JwtSubjectFactory.java    From wetech-admin with MIT License 4 votes vote down vote up
@Override
public Subject createSubject(SubjectContext context) {
    //不创建session
    context.setSessionCreationEnabled(false);
    return super.createSubject(context);
}