Tabnine Logo
Session.getAttributeKeys
Code IndexAdd Tabnine to your IDE (free)

How to use
getAttributeKeys
method
in
org.apache.shiro.session.Session

Best Java code snippets using org.apache.shiro.session.Session.getAttributeKeys (Showing top 16 results out of 315)

origin: apache/shiro

/**
 * Immediately delegates to the underlying proxied session.
 */
public Collection<Object> getAttributeKeys() throws InvalidSessionException {
  return delegate.getAttributeKeys();
}
origin: apache/shiro

@SuppressWarnings({"unchecked"})
protected Set<String> getKeyNames() {
  Collection<Object> keySet;
  try {
    keySet = getSession().getAttributeKeys();
  } catch (InvalidSessionException e) {
    throw new IllegalStateException(e);
  }
  Set<String> keyNames;
  if (keySet != null && !keySet.isEmpty()) {
    keyNames = new HashSet<String>(keySet.size());
    for (Object o : keySet) {
      keyNames.add(o.toString());
    }
  } else {
    keyNames = Collections.EMPTY_SET;
  }
  return keyNames;
}
origin: apache/shiro

public Collection<Object> getAttributeKeys(SessionKey key) {
  Collection<Object> c = lookupRequiredSession(key).getAttributeKeys();
  if (!CollectionUtils.isEmpty(c)) {
    return Collections.unmodifiableCollection(c);
  }
  return Collections.emptySet();
}
origin: killbill/killbill

  private byte[] serializeSessionData(final Session session) throws IOException {
    final Map<Object, Object> sessionAttributes = new HashMap<Object, Object>();
    for (final Object key : session.getAttributeKeys()) {
      sessionAttributes.put(key, session.getAttribute(key));
    }

    return serializer.serialize(sessionAttributes);
  }
}
origin: Graylog2/graylog2-server

@Override
protected Serializable doCreate(Session session) {
  final Serializable id = generateSessionId(session);
  assignSessionId(session, id);
  Map<String, Object> fields = Maps.newHashMap();
  fields.put("session_id", id);
  fields.put("host", session.getHost());
  fields.put("start_timestamp", session.getStartTimestamp());
  fields.put("last_access_time", session.getLastAccessTime());
  fields.put("timeout", session.getTimeout());
  Map<String, Object> attributes = Maps.newHashMap();
  for (Object key : session.getAttributeKeys()) {
    attributes.put(key.toString(), session.getAttribute(key));
  }
  fields.put("attributes", attributes);
  final MongoDbSession dbSession = new MongoDbSession(fields);
  final String objectId = mongoDBSessionService.saveWithoutValidation(dbSession);
  LOG.debug("Created session {}", objectId);
  return id;
}
origin: apache/shiro

  private void tryToCleanSession(Session session) {
    Collection<Object> keys = session.getAttributeKeys();
    for (Object key : keys) {
      session.removeAttribute(key);
    }
  }
};
origin: org.apache.shiro/shiro-core

/**
 * Immediately delegates to the underlying proxied session.
 */
public Collection<Object> getAttributeKeys() throws InvalidSessionException {
  return delegate.getAttributeKeys();
}
origin: org.apache.shiro/shiro-core

public Collection<Object> getAttributeKeys(SessionKey key) {
  Collection<Object> c = lookupRequiredSession(key).getAttributeKeys();
  if (!CollectionUtils.isEmpty(c)) {
    return Collections.unmodifiableCollection(c);
  }
  return Collections.emptySet();
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.shiro

/**
 * Immediately delegates to the underlying proxied session.
 */
public Collection<Object> getAttributeKeys() throws InvalidSessionException {
  return delegate.getAttributeKeys();
}
origin: com.ning.billing/killbill-util

  private byte[] serializeSessionData(final Session session) throws IOException {
    final Map<Object, Object> sessionAttributes = new HashMap<Object, Object>();
    for (final Object key : session.getAttributeKeys()) {
      sessionAttributes.put(key, session.getAttribute(key));
    }

    return serializer.serialize(sessionAttributes);
  }
}
origin: org.kill-bill.billing/killbill-util

  private byte[] serializeSessionData(final Session session) throws IOException {
    final Map<Object, Object> sessionAttributes = new HashMap<Object, Object>();
    for (final Object key : session.getAttributeKeys()) {
      sessionAttributes.put(key, session.getAttribute(key));
    }

    return serializer.serialize(sessionAttributes);
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.shiro

public Collection<Object> getAttributeKeys(SessionKey key) {
  Collection<Object> c = lookupRequiredSession(key).getAttributeKeys();
  if (!CollectionUtils.isEmpty(c)) {
    return Collections.unmodifiableCollection(c);
  }
  return Collections.emptySet();
}
origin: org.graylog2/graylog2-server

@Override
protected Serializable doCreate(Session session) {
  final Serializable id = generateSessionId(session);
  assignSessionId(session, id);
  Map<String, Object> fields = Maps.newHashMap();
  fields.put("session_id", id);
  fields.put("host", session.getHost());
  fields.put("start_timestamp", session.getStartTimestamp());
  fields.put("last_access_time", session.getLastAccessTime());
  fields.put("timeout", session.getTimeout());
  Map<String, Object> attributes = Maps.newHashMap();
  for (Object key : session.getAttributeKeys()) {
    attributes.put(key.toString(), session.getAttribute(key));
  }
  fields.put("attributes", attributes);
  final MongoDbSession dbSession = new MongoDbSession(fields);
  final String objectId = mongoDBSessionService.saveWithoutValidation(dbSession);
  LOG.debug("Created session {}", objectId);
  return id;
}
origin: org.seedstack.seed/seed-web-security

  /**
   * Regenerate the session if any. This prevents a potential session fixation issue by forcing a new session id on
   * login success. See https://issues.apache.org/jira/browse/SHIRO-170.
   *
   * @param subject the successfully logged in subject
   */
  default void regenerateSession(Subject subject) {
    Session session = subject.getSession(false);
    if (session != null) {
      // Retain session attributes
      Map<Object, Object> attributes = new LinkedHashMap<>();
      for (Object key : session.getAttributeKeys()) {
        Object value = session.getAttribute(key);
        if (value != null) {
          attributes.put(key, value);
        }
      }

      // Destroy the current sessions and recreate a new one
      session.stop();
      session = subject.getSession(true);

      // Restore attributes in the new session
      for (Map.Entry<Object, Object> entry : attributes.entrySet()) {
        session.setAttribute(entry.getKey(), entry.getValue());
      }
    }
  }
}
origin: com.gitee.zhaohuihua/bdp-general-web

Collection<Object> temp = session.getAttributeKeys();
for (Object o : temp) {
  keys.add(o);
origin: com.gitee.qdbp/qdbp-general-ctl

Collection<Object> temp = session.getAttributeKeys();
for (Object o : temp) {
  keys.add(o);
org.apache.shiro.sessionSessiongetAttributeKeys

Javadoc

Returns the keys of all the attributes stored under this session. If there are no attributes, this returns an empty collection.

Popular methods of Session

  • getAttribute
    Returns the object bound to this session identified by the specified key. If there is no object boun
  • setAttribute
    Binds the specified value to this session, uniquely identified by the specifed key name. If there is
  • getId
    Returns the unique identifier assigned by the system upon session creation. All return values from t
  • removeAttribute
    Removes (unbinds) the object bound to this session under the specified key name.
  • getHost
    Returns the host name or IP string of the host that originated this session, or nullif the host is u
  • getTimeout
    Returns the time in milliseconds that the session session may remain idle before expiring. * A negat
  • getLastAccessTime
    Returns the last time the application received a request or method invocation from the user associat
  • getStartTimestamp
    Returns the time the session was started; that is, the time the system created the instance.
  • setTimeout
    Sets the time in milliseconds that the session may remain idle before expiring. * A negative val
  • stop
    Explicitly stops (invalidates) this session and releases all associated resources. If this session h
  • touch
    Explicitly updates the #getLastAccessTime() of this session to the current time when this method is
  • touch

Popular in Java

  • Parsing JSON documents to java classes using gson
  • onRequestPermissionsResult (Fragment)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getSharedPreferences (Context)
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now