You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by apowell <ap...@gmail.com> on 2017/10/25 00:13:33 UTC

Principal Tag Not Working As Expected

Using Tomcat 8.5.23  I am able to login/logout and user other tags
(hasPersmission, etc.) without any issue. 

Reference: http://shiro.apache.org/web.html#typed-principal

Works as expected:
Hello, <shiro:principal/>, how are you today? 

Returns Hello,, how are you today? I have even tried type="User" with the
same result (w/o type it crashes):
Hello, <shiro:principal type="com.test.User" property="firstName"/> , how
are you today? - 

User Class:
public class User implements Serializable {
    private int userId;
    private String firstName;
    private String lastName;
    private String userName;
    private String emailAddress;
    private String password;
    private String department;
    private String role;

    public User(){

    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getEmailAddress() {
        return emailAddress;
    }

    public void setEmailAddress(String emailAddress) {
        this.emailAddress = emailAddress;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getDepartment() {
        return department;
    }

    public void setDepartment(String department) {
        this.department = department;
    }

    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role;
    }
}

I have looked throughout Google and SO without any success. Any help would
be appreciated. 




--
Sent from: http://shiro-user.582556.n2.nabble.com/