Example usage for org.apache.wicket.markup.html WebMarkupContainer getSession

List of usage examples for org.apache.wicket.markup.html WebMarkupContainer getSession

Introduction

In this page you can find the example usage for org.apache.wicket.markup.html WebMarkupContainer getSession.

Prototype

public Session getSession() 

Source Link

Document

Gets the current Session object.

Usage

From source file:org.geoserver.web.DefaultGeoServerNodeInfo.java

License:Open Source License

/**
 * The element is visible if an admin is logged in, and the id is not null
 * @param parent/*w  w w  .  ja va  2  s.  c  o  m*/
 * @return
 */
protected boolean isNodeIdVisible(WebMarkupContainer parent) {
    if (NODE_ID == null) {
        return false;
    }
    // we don't show the node id to all users, only to the admin
    Authentication auth = ((GeoServerSession) parent.getSession()).getAuthentication();
    if (auth == null || !auth.isAuthenticated() || auth instanceof AnonymousAuthenticationToken) {
        return false;
    } else {
        GeoServerSecurityManager securityManager = GeoServerApplication.get().getSecurityManager();
        return securityManager.checkAuthenticationForAdminRole(auth);
    }
}