Package org.springframework.security

Examples of org.springframework.security.GrantedAuthorityImpl


          }

          List<String> roles = getUserRoleListService().getRolesForUser( JcrTenantUtils.getCurrentTenant(), username );
          authorities = new GrantedAuthority[ roles.size() ];
          for ( int i = 0; i < roles.size(); i++ ) {
            authorities[ i ] = new GrantedAuthorityImpl( roles.get( i ) );
          }
        } else {
          authorities = auth.getAuthorities();
        }

        auths = new GrantedAuthority[ authorities.length ];
        // cache the roles while we're here
        for ( int i = 0; i < authorities.length; i++ ) {
          String role = authorities[ i ].getAuthority();
          final String tenatedRoleString = JcrTenantUtils.getTenantedRole( role );
          synchronized ( roleCache ) {
            if ( !roleCache.containsKey( role ) ) {
              final SpringSecurityRolePrincipal ssRolePrincipal = new SpringSecurityRolePrincipal( tenatedRoleString );
              roleCache.put( role, ssRolePrincipal );
            }
          }
          auths[ i ] = new GrantedAuthorityImpl( tenatedRoleString );
        }
        if ( logger.isTraceEnabled() ) {
          logger.trace( "found user in back-end " + user.getUsername() ); //$NON-NLS-1$
        }
      } catch ( UsernameNotFoundException e ) {
View Full Code Here


    pentahoSession.setAuthenticated( null, username );
    PentahoSessionHolder.setSession( pentahoSession );
    final String password = "ignored";

    List<GrantedAuthority> authList = new ArrayList<GrantedAuthority>();
    authList.add( new GrantedAuthorityImpl( tenantAdminRoleId ) );
    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

      //parse authorities, may return empty
      String[] roles = StringUtils.commaDelimitedListToStringArray(authoritiesAsText);
      GrantedAuthority[] authorities = new GrantedAuthority[roles.length];
      int i =0 ;
      for(String role : roles){
        authorities[i++] = new GrantedAuthorityImpl(role);
      }
     
      domainMap.put(domain, authorities);
     
    }
View Full Code Here

   
    //build query
    authoritiesMappingSqlQuery = new MappingSqlQuery(getDataSource(), getFetchAuthoritiesByEmailQuery()) {
      @Override
      protected GrantedAuthority mapRow(ResultSet rs, int rowNum) throws SQLException, IllegalArgumentException {
        return new GrantedAuthorityImpl(rs.getString(getResultRoleColumnNumber()));
      }
    };
    authoritiesMappingSqlQuery.declareParameter(new SqlParameter(Types.VARCHAR));
    authoritiesMappingSqlQuery.compile();
       
View Full Code Here

        List<GrantedAuthority> grantedAuthorities = new ArrayList<GrantedAuthority>();
       
        if (response.getRoles() != null) {
            for (final String role : response.getRoles()) {
               
                grantedAuthorities.add(new GrantedAuthorityImpl("ROLE_"
                                        + (this.convertToUpperCase ? role.toUpperCase() : role)));
            }
        }
        return new FederationUser(response.getUsername(), "N/A",
                                  (GrantedAuthority[]) grantedAuthorities.toArray(
View Full Code Here

        if (this.convertToUpperCase) {
            grantedAuthorityString = grantedAuthorityString.toUpperCase();
        }

        return new GrantedAuthorityImpl(grantedAuthorityString);
    }
View Full Code Here

    }

    @Test
    public void testPrefixAndUppercase() {
        FqnGrantedAuthorityFactory factory = new FqnGrantedAuthorityFactory("prefix_", true);
        assertEquals(new GrantedAuthorityImpl("PREFIX_GROUP"), factory.createGrantedAuthority(this.group));
    }
View Full Code Here

    }

    @Test
    public void testPrefixAndLowercase() {
        FqnGrantedAuthorityFactory factory = new FqnGrantedAuthorityFactory("prefix_", false);
        assertEquals(new GrantedAuthorityImpl("prefix_group"), factory.createGrantedAuthority(this.group));
    }
View Full Code Here

    }

    @Test
    public void testNoPrefixAndUppercase() {
        FqnGrantedAuthorityFactory factory = new FqnGrantedAuthorityFactory(null, true);
        assertEquals(new GrantedAuthorityImpl("GROUP"), factory.createGrantedAuthority(this.group));
    }
View Full Code Here

    }

    @Test
    public void testNoPrefixAndLowercase() {
        FqnGrantedAuthorityFactory factory = new FqnGrantedAuthorityFactory(null, false);
        assertEquals(new GrantedAuthorityImpl("group"), factory.createGrantedAuthority(this.group));
    }
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.