Example usage for org.springframework.security.access.vote AuthenticatedVoter IS_AUTHENTICATED_ANONYMOUSLY

List of usage examples for org.springframework.security.access.vote AuthenticatedVoter IS_AUTHENTICATED_ANONYMOUSLY

Introduction

In this page you can find the example usage for org.springframework.security.access.vote AuthenticatedVoter IS_AUTHENTICATED_ANONYMOUSLY.

Prototype

String IS_AUTHENTICATED_ANONYMOUSLY

To view the source code for org.springframework.security.access.vote AuthenticatedVoter IS_AUTHENTICATED_ANONYMOUSLY.

Click Source Link

Usage

From source file:ubic.gemma.security.SecurityServiceImpl.java

@Override
public boolean isPrivate(Securable s) {

    if (s == null) {
        log.warn("Null object: considered public!");
        return false;
    }/*from  w w  w  .  ja  v a 2 s.c  o m*/

    /*
     * Implementation note: this code mimics AclEntryVoter.vote, but in adminsitrative mode so no auditing etc
     * happens.
     */

    List<Permission> perms = new Vector<Permission>();
    perms.add(BasePermission.READ);

    Sid anonSid = new GrantedAuthoritySid(
            new GrantedAuthorityImpl(AuthenticatedVoter.IS_AUTHENTICATED_ANONYMOUSLY));

    List<Sid> sids = new Vector<Sid>();
    sids.add(anonSid);

    ObjectIdentity oi = objectIdentityRetrievalStrategy.getObjectIdentity(s);

    /*
     * Note: in theory, it should pay attention to the sid we ask for and return nothing if there is no acl.
     * However, the implementation actually ignores the sid argument. See BasicLookupStrategy
     */
    try {
        Acl acl = this.aclService.readAclById(oi, sids);

        assert acl != null;

        return SecurityUtil.isPrivate(acl);
    } catch (NotFoundException nfe) {
        return true;
    }
}