org.springframework.security.acls.domain.AclAuthorizationStrategy Java Examples

The following examples show how to use org.springframework.security.acls.domain.AclAuthorizationStrategy. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MutableAclImpl.java    From haven-platform with Apache License 2.0 6 votes vote down vote up
@Override
public void insertAce(int atIndexLocation, Permission permission, Sid sid, boolean granting) throws NotFoundException {
    aclAuthorizationStrategy.securityCheck(this, AclAuthorizationStrategy.CHANGE_GENERAL);
    Assert.notNull(permission, "Permission required");
    Assert.notNull(sid, "Sid required");
    if (atIndexLocation < 0) {
        throw new NotFoundException("atIndexLocation must be greater than or equal to zero");
    }
    if (atIndexLocation > this.aces.size()) {
        throw new NotFoundException("atIndexLocation must be less than or equal to the size of the AccessControlEntry collection");
    }

    AccessControlEntryImpl ace = new AccessControlEntryImpl.Builder()
            .acl(this)
            .sid(TenantSid.from(sid))
            .permission(permission)
            .granting(granting).build();

    synchronized (aces) {
        this.aces.add(atIndexLocation, ace);
    }
}
 
Example #2
Source File: MutableAclImpl.java    From haven-platform with Apache License 2.0 5 votes vote down vote up
@Override
public void deleteAce(int aceIndex) throws NotFoundException {
    aclAuthorizationStrategy.securityCheck(this, AclAuthorizationStrategy.CHANGE_GENERAL);
    verifyAceIndexExists(aceIndex);

    synchronized (aces) {
        this.aces.remove(aceIndex);
    }
}
 
Example #3
Source File: MutableAclImpl.java    From haven-platform with Apache License 2.0 5 votes vote down vote up
@Override
public void updateAce(int aceIndex, Permission permission)
    throws NotFoundException {
    aclAuthorizationStrategy.securityCheck(this, AclAuthorizationStrategy.CHANGE_GENERAL);
    verifyAceIndexExists(aceIndex);

    synchronized (aces) {
        AccessControlEntryImpl ace = (AccessControlEntryImpl) aces.get(aceIndex);
        aces.set(aceIndex, new AccessControlEntryImpl.Builder().from(ace).permission(permission).build());
    }
}
 
Example #4
Source File: MutableAclImpl.java    From haven-platform with Apache License 2.0 5 votes vote down vote up
@Override
public void updateAuditing(int aceIndex, boolean auditSuccess, boolean auditFailure) {
    aclAuthorizationStrategy.securityCheck(this, AclAuthorizationStrategy.CHANGE_AUDITING);
    verifyAceIndexExists(aceIndex);

    synchronized (aces) {
        AccessControlEntryImpl ace = (AccessControlEntryImpl) aces.get(aceIndex);
        aces.set(aceIndex, new AccessControlEntryImpl.Builder().from(ace)
                .auditSuccess(auditSuccess)
                .auditFailure(auditFailure)
                .build());
    }
}
 
Example #5
Source File: MutableAclImpl.java    From haven-platform with Apache License 2.0 4 votes vote down vote up
public AclAuthorizationStrategy getAclAuthorizationStrategy() {
    return aclAuthorizationStrategy;
}
 
Example #6
Source File: MutableAclImpl.java    From haven-platform with Apache License 2.0 4 votes vote down vote up
public void setAclAuthorizationStrategy(AclAuthorizationStrategy aclAuthorizationStrategy) {
    this.aclAuthorizationStrategy = aclAuthorizationStrategy;
}
 
Example #7
Source File: MutableAclImpl.java    From haven-platform with Apache License 2.0 4 votes vote down vote up
@Override
public void setEntriesInheriting(boolean entriesInheriting) {
    aclAuthorizationStrategy.securityCheck(this, AclAuthorizationStrategy.CHANGE_GENERAL);
    this.entriesInheriting = entriesInheriting;
}
 
Example #8
Source File: MutableAclImpl.java    From haven-platform with Apache License 2.0 4 votes vote down vote up
@Override
public void setOwner(Sid newOwner) {
    aclAuthorizationStrategy.securityCheck(this, AclAuthorizationStrategy.CHANGE_OWNERSHIP);
    Assert.notNull(newOwner, "Owner required");
    this.owner = newOwner;
}
 
Example #9
Source File: MutableAclImpl.java    From haven-platform with Apache License 2.0 4 votes vote down vote up
@Override
public void setParent(Acl newParent) {
    aclAuthorizationStrategy.securityCheck(this, AclAuthorizationStrategy.CHANGE_GENERAL);
    Assert.isTrue(newParent == null || !newParent.equals(this), "Cannot be the parent of yourself");
    this.parentAcl = newParent;
}
 
Example #10
Source File: ACLContext.java    From tutorials with MIT License 4 votes vote down vote up
@Bean
public AclAuthorizationStrategy aclAuthorizationStrategy() {
    return new AclAuthorizationStrategyImpl(new SimpleGrantedAuthority("ROLE_ADMIN"));
}