Package org.uberfire.security.impl

Examples of org.uberfire.security.impl.RoleImpl


                    final List<Role> roles;
                    if ( access != null ) {
                        final String[] textRoles = access.split( "," );
                        roles = new ArrayList<Role>( textRoles.length );
                        for ( final String textRole : textRoles ) {
                            roles.add( new RoleImpl( textRole ) );
                        }
                        mandatoryFilteredResources.put( pattern, roles );
                    } else {
                        roles = emptyList();
                    }
View Full Code Here


    /**
     * Registers given <code>role</code> into the registry
     * @param role
     */
    public void registerRole( String role ) {
        this.roles.add( new RoleImpl( role ) );
    }
View Full Code Here

        protected TestIdentity(String name, String... rolesIn) {
            this.name = name;
            this.roles = new ArrayList<Role>();

            for (String role : rolesIn) {
                roles.add(new RoleImpl(role));
            }
        }
View Full Code Here

            try {
                Method method = registry.getClass().getMethod( "getGroupsForUser", new Class[]{ String.class } );
                List rolesIn = (List) method.invoke( registry, new Object[]{ principal.getName() } );
                if ( rolesIn != null ) {
                    for ( Object o : rolesIn ) {
                        roles.add( new RoleImpl( o.toString() ) );
                    }
                }
            } catch ( Exception e ) {
                logger.error( "Unable to get groups from registry due to {}", e.getMessage(), e );
            }
        }

        if ( mode.equals( RolesMode.ROLE ) || mode.equals( RolesMode.BOTH ) ) {
            if ( securityContext instanceof HttpSecurityContext ) {
                final HttpServletRequest request = ( (HttpSecurityContext) securityContext ).getRequest();
                for ( final Role enforcementRole : RolesRegistry.get().getRegisteredRoles() ) {
                    if ( request.isUserInRole( enforcementRole.getName() ) ) {
                        roles.add( new RoleImpl( enforcementRole.getName() ) );
                    }
                }
            } else {
                if ( roleProviderServices != null ) {
                    roles.addAll( roleProviderServices.getRoles() );
View Full Code Here

            final List<Role> roles = new ArrayList<Role>();
            final SessionContext sctxLookup = InitialContext.doLookup( "java:comp/EJBContext" );

            for ( final Role enforcementRole : RolesRegistry.get().getRegisteredRoles() ) {
                if ( sctxLookup.isCallerInRole( enforcementRole.getName() ) ) {
                    roles.add( new RoleImpl( enforcementRole.getName() ) );
                }
            }

            return roles;
        } catch ( NamingException e ) {
View Full Code Here

                Method method = webLogicSecurity.getMethod("getCurrentSubject", new Class[]{});
                Subject wlsSubject = (Subject) method.invoke( null, new Object[]{ } );
                if ( wlsSubject != null ) {
                    for ( java.security.Principal p : wlsSubject.getPrincipals() ) {
                        if (p.getClass().getName().indexOf("WLSGroup") != -1) {
                            roles.add( new RoleImpl( p.getName() ) );
                        }
                    }
                }
            } catch ( Exception e ) {
                logger.error( "Unable to get groups from subject due to {}", e.getMessage(), e );
            }
        }

        if ( mode.equals( RolesMode.ROLE ) || mode.equals( RolesMode.BOTH ) ) {
            if ( securityContext instanceof HttpSecurityContext ) {
                final HttpServletRequest request = ( (HttpSecurityContext) securityContext ).getRequest();
                for ( final Role enforcementRole : RolesRegistry.get().getRegisteredRoles() ) {
                    if ( request.isUserInRole( enforcementRole.getName() ) ) {
                        roles.add( new RoleImpl( enforcementRole.getName() ) );
                    }
                }
            } else {
                if ( roleProviderServices != null ) {
                    roles.addAll( roleProviderServices.getRoles() );
View Full Code Here

            throw new AuthenticationException( "Invalid credentials." );
        }

        final List<Role> roles = new ArrayList<Role>();
        if ( isRememberOp ) {
            roles.add( new RoleImpl( ROLE_REMEMBER_ME ) );
        }

        for ( final RoleProvider roleProvider : roleProviders ) {
            roles.addAll( roleProvider.loadRoles( principal, context ) );
        }
View Full Code Here

                    for ( java.security.Principal p : principals ) {
                        if ( p instanceof Group && rolePrincipleName.equalsIgnoreCase( p.getName() ) ) {
                            final Enumeration<? extends java.security.Principal> groups = ( (Group) p ).members();
                            while ( groups.hasMoreElements() ) {
                                final java.security.Principal groupPrincipal = groups.nextElement();
                                roles.add( new RoleImpl( groupPrincipal.getName() ) );
                            }
                            break;
                        }
                    }
                }
View Full Code Here

                if ( p instanceof Group && rolePrincipleName.equalsIgnoreCase( p.getName() ) ) {
                    Enumeration<? extends java.security.Principal> groups = ( (Group) p ).members();

                    while ( groups.hasMoreElements() ) {
                        final java.security.Principal groupPrincipal = groups.nextElement();
                        roles.add( new RoleImpl( groupPrincipal.getName() ) );
                    }
                    break;
                }
            }
        }
View Full Code Here

        if ( securityContext instanceof HttpSecurityContext ) {
            final HttpServletRequest request = ( (HttpSecurityContext) securityContext ).getRequest();
            for ( final Role enforcementRole : RolesRegistry.get().getRegisteredRoles() ) {
                if ( request.isUserInRole( enforcementRole.getName() ) ) {
                    roles.add( new RoleImpl( enforcementRole.getName() ) );
                }
            }
        }

        return roles;
View Full Code Here

TOP

Related Classes of org.uberfire.security.impl.RoleImpl

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.