org.apache.shiro.util.ThreadContext.get()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(209)

本文整理了Java中org.apache.shiro.util.ThreadContext.get()方法的一些代码示例,展示了ThreadContext.get()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ThreadContext.get()方法的具体详情如下:
包路径:org.apache.shiro.util.ThreadContext
类名称:ThreadContext
方法名:get

ThreadContext.get介绍

[英]Returns the object for the specified key that is bound to the current thread.
[中]返回绑定到当前线程的指定key的对象。

代码示例

代码示例来源:origin: apache/shiro

/**
 * Convenience method that simplifies retrieval of a thread-bound Subject.  If there is no
 * Subject bound to the thread, this method returns <tt>null</tt>.  It is merely a convenient wrapper
 * for the following:
 * <p/>
 * <code>return (Subject)get( SUBJECT_KEY );</code>
 * <p/>
 * This method only returns the bound value if it exists - it does not remove it
 * from the thread.  To remove it, one must call {@link #unbindSubject() unbindSubject()} instead.
 *
 * @return the Subject object bound to the thread, or <tt>null</tt> if there isn't one bound.
 * @since 0.2
 */
public static Subject getSubject() {
  return (Subject) get(SUBJECT_KEY);
}

代码示例来源:origin: apache/shiro

/**
 * Convenience method that simplifies retrieval of the application's SecurityManager instance from the current
 * thread. If there is no SecurityManager bound to the thread (probably because framework code did not bind it
 * to the thread), this method returns <tt>null</tt>.
 * <p/>
 * It is merely a convenient wrapper for the following:
 * <p/>
 * <code>return (SecurityManager)get( SECURITY_MANAGER_KEY );</code>
 * <p/>
 * This method only returns the bound value if it exists - it does not remove it
 * from the thread.  To remove it, one must call {@link #unbindSecurityManager() unbindSecurityManager()} instead.
 *
 * @return the Subject object bound to the thread, or <tt>null</tt> if there isn't one bound.
 * @since 0.9
 */
public static SecurityManager getSecurityManager() {
  return (SecurityManager) get(SECURITY_MANAGER_KEY);
}

代码示例来源:origin: Graylog2/graylog2-server

public static boolean isSessionCreationRequested() {
  return Boolean.TRUE.equals(ThreadContext.get(AUTO_CREATE_SESSION_KEY));
}

代码示例来源:origin: Graylog2/graylog2-server

final MultivaluedMap<String, String> requestHeaders = (MultivaluedMap<String, String>) ThreadContext.get(
    ShiroSecurityContextFilter.REQUEST_HEADERS);

代码示例来源:origin: org.apache.shiro/shiro-core

/**
 * Convenience method that simplifies retrieval of a thread-bound Subject.  If there is no
 * Subject bound to the thread, this method returns <tt>null</tt>.  It is merely a convenient wrapper
 * for the following:
 * <p/>
 * <code>return (Subject)get( SUBJECT_KEY );</code>
 * <p/>
 * This method only returns the bound value if it exists - it does not remove it
 * from the thread.  To remove it, one must call {@link #unbindSubject() unbindSubject()} instead.
 *
 * @return the Subject object bound to the thread, or <tt>null</tt> if there isn't one bound.
 * @since 0.2
 */
public static Subject getSubject() {
  return (Subject) get(SUBJECT_KEY);
}

代码示例来源:origin: org.apache.shiro/shiro-core

/**
 * Convenience method that simplifies retrieval of the application's SecurityManager instance from the current
 * thread. If there is no SecurityManager bound to the thread (probably because framework code did not bind it
 * to the thread), this method returns <tt>null</tt>.
 * <p/>
 * It is merely a convenient wrapper for the following:
 * <p/>
 * <code>return (SecurityManager)get( SECURITY_MANAGER_KEY );</code>
 * <p/>
 * This method only returns the bound value if it exists - it does not remove it
 * from the thread.  To remove it, one must call {@link #unbindSecurityManager() unbindSecurityManager()} instead.
 *
 * @return the Subject object bound to the thread, or <tt>null</tt> if there isn't one bound.
 * @since 0.9
 */
public static SecurityManager getSecurityManager() {
  return (SecurityManager) get(SECURITY_MANAGER_KEY);
}

代码示例来源:origin: be.c4j.ee.security.octopus/octopus-core

public static boolean isInAuthenticationEvent() {
  return ThreadContext.get(OctopusAuthenticationListener.IN_AUTHENTICATION_EVENT_FLAG) instanceof OctopusAuthenticationListener.InAuthenticationEvent;
}

代码示例来源:origin: be.c4j.ee.security.octopus/octopus-core

public static boolean isInAuthorization() {
  return ThreadContext.get(OctopusRealm.IN_AUTHORIZATION_FLAG) instanceof OctopusRealm.InAuthorization
      || ThreadContext.get(OctopusRealm.IN_AUTHORIZATION_FLAG) instanceof OctopusRealmAuthenticator.InAuthorization;
}

代码示例来源:origin: be.c4j.ee.security.octopus/octopus-core

public static boolean isInAuthentication() {
  return ThreadContext.get(OctopusRealm.IN_AUTHENTICATION_FLAG) instanceof OctopusRealm.InAuthentication;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.shiro

/**
 * Convenience method that simplifies retrieval of a thread-bound Subject.  If there is no
 * Subject bound to the thread, this method returns <tt>null</tt>.  It is merely a convenient wrapper
 * for the following:
 * <p/>
 * <code>return (Subject)get( SUBJECT_KEY );</code>
 * <p/>
 * This method only returns the bound value if it exists - it does not remove it
 * from the thread.  To remove it, one must call {@link #unbindSubject() unbindSubject()} instead.
 *
 * @return the Subject object bound to the thread, or <tt>null</tt> if there isn't one bound.
 * @since 0.2
 */
public static Subject getSubject() {
  return (Subject) get(SUBJECT_KEY);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.shiro

/**
 * Convenience method that simplifies retrieval of the application's SecurityManager instance from the current
 * thread. If there is no SecurityManager bound to the thread (probably because framework code did not bind it
 * to the thread), this method returns <tt>null</tt>.
 * <p/>
 * It is merely a convenient wrapper for the following:
 * <p/>
 * <code>return (SecurityManager)get( SECURITY_MANAGER_KEY );</code>
 * <p/>
 * This method only returns the bound value if it exists - it does not remove it
 * from the thread.  To remove it, one must call {@link #unbindSecurityManager() unbindSecurityManager()} instead.
 *
 * @return the Subject object bound to the thread, or <tt>null</tt> if there isn't one bound.
 * @since 0.9
 */
public static SecurityManager getSecurityManager() {
  return (SecurityManager) get(SECURITY_MANAGER_KEY);
}

代码示例来源:origin: org.graylog2/graylog2-server

public static boolean isSessionCreationRequested() {
  return Boolean.TRUE.equals(ThreadContext.get(AUTO_CREATE_SESSION_KEY));
}

代码示例来源:origin: org.graylog2/graylog2-server

final MultivaluedMap<String, String> requestHeaders = (MultivaluedMap<String, String>) ThreadContext.get(
    ShiroSecurityContextFilter.REQUEST_HEADERS);

相关文章