All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.actioncontrollerdemo.DemoPrincipal Maven / Gradle / Ivy

There is a newer version: 0.0.41
Show newest version
package org.actioncontrollerdemo;

import java.security.Principal;

public class DemoPrincipal implements Principal {
    private DemoUser demoUser;

    public DemoPrincipal(DemoUser demoUser) {
        this.demoUser = demoUser;
    }

    public static Principal createPrincipal(String username) {
        DemoUser user = new DemoUser(username);
        return user.getUsername().equals("admin") ? new AdminPrincipal(user) : new DemoPrincipal(user);
    }

    @Override
    public String getName() {
        return demoUser.getUsername();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy