Example usage for org.apache.shiro.authc SimpleAccount getPrincipals

List of usage examples for org.apache.shiro.authc SimpleAccount getPrincipals

Introduction

In this page you can find the example usage for org.apache.shiro.authc SimpleAccount getPrincipals.

Prototype

public PrincipalCollection getPrincipals() 

Source Link

Document

Returns the principals, aka the identifying attributes (username, user id, first name, last name, etc) of this Account.

Usage

From source file:at.pollux.thymeleaf.shiro.dialect.test.TestIniRealm.java

License:Apache License

@Override
protected void add(SimpleAccount account) {
    String username = (String) account.getPrincipals().getPrimaryPrincipal();

    // Let's add some additional principals for testing
    SimplePrincipalCollection principalCollection = new SimplePrincipalCollection();
    principalCollection.addAll(account.getPrincipals());
    principalCollection.add(counter.getAndIncrement(), "integerRealm");
    TestObjPrincipal objPrinc = new TestObjPrincipal(username.toUpperCase() + " " + username.toUpperCase());
    principalCollection.add(objPrinc, "objRealm");
    account.setPrincipals(principalCollection);

    super.add(account);
}

From source file:org.ms123.common.permission.MyRealm.java

License:Open Source License

protected String getUsername(SimpleAccount account) {
    return getUsername(account.getPrincipals());
}

From source file:org.zunpeng.thymeleaf.shiro.dialect.test.TestIniRealm.java

License:Apache License

@Override
protected void add(SimpleAccount account) {
    String username = (String) account.getPrincipals().getPrimaryPrincipal();

    // Let's add some additional principals for testing
    SimplePrincipalCollection principalCollection = new SimplePrincipalCollection();
    principalCollection.addAll(account.getPrincipals());
    principalCollection.add(counter.getAndIncrement(), "integerRealm");
    TestObjPrincipal objPrinc = new TestObjPrincipal(username.toUpperCase() + " " + username.toUpperCase());
    principalCollection.add(objPrinc, "objRealm");
    account.setPrincipals(principalCollection);

    super.add(account); //To change body of generated methods, choose Tools | Templates.
}