本文整理汇总了Java中org.apache.shiro.subject.SubjectContext.setSessionCreationEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java SubjectContext.setSessionCreationEnabled方法的具体用法?Java SubjectContext.setSessionCreationEnabled怎么用?Java SubjectContext.setSessionCreationEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.shiro.subject.SubjectContext
的用法示例。
在下文中一共展示了SubjectContext.setSessionCreationEnabled方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSubject
import org.apache.shiro.subject.SubjectContext; //导入方法依赖的package包/类
@Override
public Subject createSubject(SubjectContext context) {
context.setSessionCreationEnabled(false);
return super.createSubject(context);
}
示例2: createSubject
import org.apache.shiro.subject.SubjectContext; //导入方法依赖的package包/类
@Override
public Subject createSubject(SubjectContext context) {
//不创建session
context.setSessionCreationEnabled(false);
super.createSubject(context).getSession(false);
return super.createSubject(context);
}
示例3: createSubject
import org.apache.shiro.subject.SubjectContext; //导入方法依赖的package包/类
@Override
public Subject createSubject(SubjectContext context) {
// 不创建session
context.setSessionCreationEnabled(false);
return super.createSubject(context);
}
示例4: createSubject
import org.apache.shiro.subject.SubjectContext; //导入方法依赖的package包/类
public Subject createSubject(SubjectContext context) {
//不创建session, 如果之后调用Subject.getSession()将抛出DisabledSessionException异常。
context.setSessionCreationEnabled(false);
return super.createSubject(context);
}
示例5: createSubject
import org.apache.shiro.subject.SubjectContext; //导入方法依赖的package包/类
@Override
public Subject createSubject(SubjectContext context) {
// 不创建session
context.setSessionCreationEnabled(false);
return super.createSubject(context);
}
示例6: login
import org.apache.shiro.subject.SubjectContext; //导入方法依赖的package包/类
/**
* Logs in the specified Subject using the given {@code authenticationToken}, returning an updated Subject
* instance reflecting the authenticated state if successful or throwing {@code AuthenticationException} if it is
* not.
* <p>
* Note that most application developers should probably not call this method directly unless they have a good
* reason for doing so. The preferred way to log in a Subject is to call
* <code>subject.{@link Subject#login login(authenticationToken)}</code> (usually after
* acquiring the Subject by calling {@link SecurityUtils#getSubject() SecurityUtils.getSubject()}).
* <p>
* Framework developers on the other hand might find calling this method directly useful in certain cases.
*
* @param subject the subject against which the authentication attempt will occur
* @param authenticationToken the token representing the Subject's principal(s) and credential(s)
* @return the subject instance reflecting the authenticated state after a successful attempt
* @throws AuthenticationException if the login attempt failed.
* @since 1.0
*/
@Override
public Subject login(Subject subject, AuthenticationToken authenticationToken) throws AuthenticationException {
AuthenticationInfo info = authenticate(authenticationToken);
SubjectContext context = new DefaultSubjectContext();
context.setAuthenticated(true);
context.setAuthenticationToken(authenticationToken);
context.setAuthenticationInfo(info);
context.setSessionCreationEnabled(true);
if (subject != null) {
context.setSubject(subject);
}
return createSubject(context);
}