Example usage for org.apache.wicket.authroles.authorization.strategies.role Roles Roles

List of usage examples for org.apache.wicket.authroles.authorization.strategies.role Roles Roles

Introduction

In this page you can find the example usage for org.apache.wicket.authroles.authorization.strategies.role Roles Roles.

Prototype

public Roles() 

Source Link

Document

Construct.

Usage

From source file:abid.password.wicket.MutablePasswordSession.java

License:Apache License

@Override
public Roles getRoles() {
    Roles roles = new Roles();
    if (isSignedIn()) {
        roles.add(Roles.ADMIN);
    }
    return roles;
}

From source file:biz.turnonline.ecosystem.origin.frontend.FrontendSession.java

License:Apache License

@Override
public Roles getRoles() {
    Roles roles = new Roles();

    if (isLoggedIn()) {
        roles.add(Role.STANDARD);
    }

    return roles;
}

From source file:ca.travelagency.authentication.AuthenticatedSession.java

License:Apache License

@Override
public final Roles getRoles() {
    Roles roles = new Roles();
    SystemUser systemUser = getSystemUser();
    if (systemUser == null) {
        signOut();//ww w.  j a v  a2  s . co m
        return roles;
    }
    for (SystemUserRole systemUserRole : systemUser.getSystemUserRoles()) {
        roles.add(systemUserRole.getRole().name());
    }
    return roles;
}

From source file:com.evolveum.midpoint.web.security.MidPointAuthWebSession.java

License:Apache License

@Override
public Roles getRoles() {
    Roles roles = new Roles();
    //todo - used for wicket auth roles...
    MidPointPrincipal principal = SecurityUtils.getPrincipalUser();
    if (principal == null) {
        return roles;
    }/* w w w . j  a va2 s  .c  o  m*/
    for (Authorization authz : principal.getAuthorities()) {
        roles.addAll(authz.getAction());
    }

    return roles;
}

From source file:com.francetelecom.clara.cloud.presentation.tools.WicketSession.java

License:Apache License

@Override
public Roles getRoles() {
    Roles roles = new Roles();
    Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
    if (authentication != null) {
        for (GrantedAuthority authority : authentication.getAuthorities()) {
            roles.add(authority.getAuthority());
        }//from  www . j  a  va2  s  . co  m
    } else {
        logger.warn("Authentication from SecurityContextHolder is null. No role affected.");
    }
    return roles;
}

From source file:com.github.ilmoeuro.hackmikkeli2016.ui.HmSession.java

License:Open Source License

@Override
public Roles getRoles() {
    return new Roles();
}

From source file:com.olegchir.flussonic_userlinks.auth.AuthChecker.java

License:Apache License

public static Roles extractRoles() {
    Roles roles = new Roles();
    Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
    for (GrantedAuthority authority : authentication.getAuthorities()) {
        roles.add(authority.getAuthority());
    }/* ww  w  . j  a va 2s  .  c  om*/
    return roles;
}

From source file:com.olegchir.wicket_spring_security_example.init.UserAuthenticatedWebSession.java

License:Apache License

@Override
public Roles getRoles() {
    Roles roles = new Roles();
    Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
    for (GrantedAuthority authority : authentication.getAuthorities()) {
        roles.add(authority.getAuthority());
    }//from   ww  w.j a v  a 2 s  .  co m
    return roles;
}

From source file:com.userweave.application.UserWeaveSession.java

License:Open Source License

public User getUser() {
    if (userId == null) {
        return null;
    }//ww w  . j a v  a 2  s .c  om

    if (user == null) {
        user = userService.findById(userId);
    }

    // load roles, if a user is in a project.
    if (projectId != null) {
        if (project == null) {
            project = projectDao.findById(projectId);
        }

        if (project != null) {
            Roles role = new Roles();

            if (user.isAdmin()) {
                role.add(Role.PROJECT_ADMIN);
            } else {
                List<Role> roles = roleDao.getRolesByUserAndProject(user, project);

                for (Role r : roles) {
                    role.add(r.getRoleName());
                }
            }

            user.setCurrentProjectRoles(role);
        }
    }

    return user;
}

From source file:com.userweave.domain.User.java

License:Open Source License

public User() {
    this.currentProjectRoles = new Roles();
}