Example usage for org.apache.shiro.authz SimpleAuthorizationInfo addObjectPermissions

List of usage examples for org.apache.shiro.authz SimpleAuthorizationInfo addObjectPermissions

Introduction

In this page you can find the example usage for org.apache.shiro.authz SimpleAuthorizationInfo addObjectPermissions.

Prototype

public void addObjectPermissions(Collection<Permission> permissions) 

Source Link

Document

Adds (assigns) multiple permissions to those associated directly with the account.

Usage

From source file:de.triology.blog.complexspermissions.ComplexPermissionRealm.java

License:Open Source License

@Override
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) {
    SimpleAuthorizationInfo authorizationInfo = new SimpleAuthorizationInfo();
    authorizationInfo.addObjectPermissions(createFilePermissions());
    return authorizationInfo;
}

From source file:org.sonatype.nexus.proxy.security.PlexusConfiguredRealm.java

License:Open Source License

@Override
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
    String username = (String) principals.iterator().next();

    // check the userPrivilageMap key set for the user

    if (StringUtils.isNotEmpty(username) && this.userPrivileges.containsKey(username)) {
        SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();

        // "nexus:target:" + <targetId> + ":" + <repoId> + ":" + <action>
        // String priv = "nexus:target:" + "*" + ":" + "repo1" + ":" + "*";
        info.addObjectPermissions(this.buildPermissions(this.userPrivileges.get(username)));
        return info;
    }/*from   w w  w.jav a 2 s .c o  m*/

    return null;
}