Example usage for org.apache.shiro.authz SimpleRole SimpleRole

List of usage examples for org.apache.shiro.authz SimpleRole SimpleRole

Introduction

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

Prototype

public SimpleRole() 

Source Link

Usage

From source file:com.freedomotic.persistence.RoleConverter.java

License:Open Source License

/**
 *
 * @param reader/*from  ww  w .  jav  a  2  s  .com*/
 * @param uc
 * @return
 */
@Override
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext uc) {

    SimpleRole r = new SimpleRole();

    r.setName(reader.getAttribute("name"));
    reader.moveDown();
    while (reader.hasMoreChildren()) {
        reader.moveDown();
        r.add(new WildcardPermission(reader.getValue()));
        reader.moveUp();
    }
    reader.moveUp();

    return r;
}

From source file:com.freedomotic.plugins.devices.restapiv3.test.UserTest.java

License:Open Source License

@Override
void init() throws UriBuilderException, IllegalArgumentException {
    SimpleRole r = new SimpleRole();
    r.setName("admin");
    r.add(new WildcardPermission("*"));
    getApi().getAuth().addRole(r);/*from   w  w  w . j av  a 2 s  .  c  o  m*/

    User u = new User("user", "password", "admin", getApi().getAuth());
    setItem(new UserRepresentation(u));

    initPath(UserResource.class);
    setListType(new GenericType<List<UserRepresentation>>() {
    });
    setSingleType(new GenericType<UserRepresentation>() {
    });
    testDELETE = false;
}

From source file:com.freedomotic.security.RealmTest.java

License:Open Source License

@Before
public void prepare() {
    config.load();/*from w  w w  . ja v a  2  s  . c o m*/
    auth.initBaseRealm();
    SimpleRole role = new SimpleRole();
    role.setName("administrators");
    role.add(new WildcardPermission("sys:*"));
    auth.addRole(role);
    auth.addUser("system", "password", "administrators");
    auth.getUser("system").setProperty("language", "auto");
}

From source file:com.freedomotic.security.UserTest.java

License:Open Source License

@Before
public void prepare() {
    config.load();//from  www  . ja  v  a2  s  .co m
    auth.initBaseRealm();
    SimpleRole role = new SimpleRole();
    role.setName("administrators");
    role.add(new WildcardPermission("sys:*"));
    auth.addRole(role);
    auth.addUser("system", "cQY3W9HCU1MpYV16/SVKFeciDoxOOkyR9cgi/XUEHig=",
            "FZ4hpINh3HLLyYcgQAy/HTWcZbNX/7R3Tn/YYYsXpQ0=", "administrators");
}