Package org.springframework.security

Examples of org.springframework.security.GrantedAuthorityImpl


                // We are not throwing UsernameNotFound exception in case of
                // openid authentication in order to recieve user SREG attributes
                // from the authentication filter and save them               
                if (userData == null) {
                     authorities = new GrantedAuthority[1];
                     GrantedAuthority g = new GrantedAuthorityImpl("openidLogin");
                     authorities[0] = g;
                     name = "openid";
                     password = "openid";
                } else {
                     authorities =  getAuthorities(userData, umgr);
View Full Code Here


     private GrantedAuthority[] getAuthorities(User userData, UserManager umgr) throws WebloggerException {
             List<String> roles = umgr.getRoles(userData);
            GrantedAuthority[] authorities = new GrantedAuthorityImpl[roles.size()];
            int i = 0;
            for (String role : roles) {
                authorities[i++] = new GrantedAuthorityImpl(role);
            }
            return authorities;
        }
View Full Code Here

        int roleCount = roles.size() + (defaultRole != null ? 1 : 0);
        GrantedAuthority[] authorities = new GrantedAuthorityImpl[roleCount];
        int i = 0;
        for(String role : roles) {
            authorities[i++] = new GrantedAuthorityImpl(role);
        }
       
        if (defaultRole != null) {
            authorities[roleCount-1] = defaultRole;
        }
View Full Code Here

     *
     * @param defaultRole the role name, including any desired prefix.
     */
    public void setDefaultRole(String defaultRole) {
        Assert.notNull(defaultRole, "The defaultRole property cannot be set to null");
        this.defaultRole = new GrantedAuthorityImpl(defaultRole);
    }
View Full Code Here

    }
    return rtn;
  }

  public String[] getUserNamesInRole( final String role ) {
    Set<String> userListForAuthority = rolesToUsersMap.get( new GrantedAuthorityImpl( role ) );
    String[] typ = {};
    if ( userListForAuthority != null ) {
      return userListForAuthority.toArray( typ );
    } else {
      return typ;
View Full Code Here

      compile();
    }

    @Override
    protected Object mapRow( final ResultSet rs, final int rownum ) throws SQLException {
      return new GrantedAuthorityImpl( ( ( null != rolePrefix ) ? rolePrefix : "" ) + rs.getString( 1 ) ); //$NON-NLS-1$
    }
View Full Code Here

    return this.recipientType;
  }

  protected void setRecipientString( final String value ) {
    if ( this.recipientType == PentahoAclEntry.RECIPIENT_GRANTEDAUTHORITY ) {
      this.setRecipient( new GrantedAuthorityImpl( value ) );
    } else {
      this.setRecipient( value );
    }

  }
View Full Code Here

    pentahoSession.setAuthenticated( username );
    pentahoSession.setAttribute( IPentahoSession.TENANT_ID_KEY, tenant.getId() );
    final String password = "password";

    List<GrantedAuthority> authList = new ArrayList<GrantedAuthority>();
    authList.add( new GrantedAuthorityImpl( "TenantAdmin" ) );
    authList.add( new GrantedAuthorityImpl( "Authenticated" ) );
    GrantedAuthority[] authorities = authList.toArray( new GrantedAuthority[0] );
    UserDetails userDetails = new User( username, password, true, true, true, true, authorities );
    Authentication auth = new UsernamePasswordAuthenticationToken( userDetails, password, authorities );
    PentahoSessionHolder.setSession( pentahoSession );
    // this line necessary for Spring Security's MethodSecurityInterceptor
View Full Code Here

    List<IPentahoRole> userRoles = userRoleDao.getUserRoles( null, username );
    int authsSize = userRoles != null ? userRoles.size() : 0;
    GrantedAuthority[] auths = new GrantedAuthority[authsSize];
    int i = 0;
    for ( IPentahoRole role : userRoles ) {
      auths[i++] = new GrantedAuthorityImpl( role.getName() );
    }

    List<GrantedAuthority> dbAuths = new ArrayList<GrantedAuthority>( Arrays.asList( auths ) );
    addCustomAuthorities( user.getUsername(), dbAuths );

    // Store the Tenant ID in the session
    IPentahoSession session = PentahoSessionHolder.getSession();
    String tenantId = (String) session.getAttribute( IPentahoSession.TENANT_ID_KEY );
    if ( tenantId == null ) {
      ITenant tenant = JcrTenantUtils.getTenant( username, true );
      session.setAttribute( IPentahoSession.TENANT_ID_KEY, tenant.getId() );
    }

    if ( !StringUtils.isEmpty( defaultRoleString ) ) {
      defaultRole = new GrantedAuthorityImpl( defaultRoleString );
    }

    if ( defaultRole != null && !dbAuths.contains( defaultRole ) ) {
      dbAuths.add( defaultRole );
    }
View Full Code Here

   *          the role name, including any desired prefix.
   */
  public void setDefaultRole( String defaultRole ) {
    Assert.notNull( defaultRole );
    this.defaultRoleString = defaultRole;
    this.defaultRole = new GrantedAuthorityImpl( defaultRole );
  }
View Full Code Here

TOP

Related Classes of org.springframework.security.GrantedAuthorityImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.