Package org.apache.wiki.auth

Examples of org.apache.wiki.auth.WikiSecurityException


        {
            m_groupDatabase = getGroupDatabase();
        }
        catch ( WikiException e )
        {
            throw new WikiSecurityException( e.getMessage(), e );
        }

        // Load all groups from the database into the cache
        Group[] groups = m_groupDatabase.groups();
        synchronized( m_groups )
View Full Code Here


            {
                name = "MyGroup";
            }
            else
            {
                throw new WikiSecurityException( "Group name cannot be blank." );
            }
        }
        else if ( ArrayUtils.contains( Group.RESTRICTED_GROUPNAMES, name ) )
        {
            // Certain names are forbidden
            throw new WikiSecurityException( "Illegal group name: " + name );
        }
        name = name.trim();

        // Normalize the member line
        if ( InputValidator.isBlank( memberLine ) )
View Full Code Here

                fireEvent( WikiSecurityEvent.GROUP_ADD, oldGroup );
                synchronized( m_groups )
                {
                    m_groups.put( oldGroup.getPrincipal(), oldGroup );
                }
                throw new WikiSecurityException( e.getMessage() + " (rolled back to previous version).", e );
            }
            // Re-throw security exception
            throw new WikiSecurityException( e.getMessage(), e );
        }
    }
View Full Code Here

        validator.validateNotNull( name, "Group name" );

        // Name cannot be one of the restricted names either
        if( ArrayUtils.contains( Group.RESTRICTED_GROUPNAMES, name ) )
        {
            throw new WikiSecurityException( "The group name '" + name + "' is illegal. Choose another." );
        }
    }
View Full Code Here

            io.write( "</groups>" );
            io.close();
        }
        catch( IOException e )
        {
            throw new WikiSecurityException( e.getLocalizedMessage(), e );
        }

        // Copy new file over old version
        File backup = new File( m_file.getAbsolutePath() + ".old" );
        if ( backup.exists() && !backup.delete())
View Full Code Here

                    return;
                }
            }

            log.debug("Failed JSON permission check: "+instance);
            throw new WikiSecurityException("No permission to access this AJAX method!");
        }
View Full Code Here

                conn.commit();
            }
        }
        catch( SQLException e )
        {
            throw new WikiSecurityException( e.getMessage(), e );
        }
        finally
        {
            try
            {
View Full Code Here

            }
            ps.close();
        }
        catch( SQLException e )
        {
            throw new WikiSecurityException( e.getMessage(), e );
        }
        finally
        {
            try
            {
View Full Code Here

                conn.commit();
            }
        }
        catch( SQLException e )
        {
            throw new WikiSecurityException( e.getMessage(), e );
        }
        finally
        {
            try
            {
View Full Code Here

                {
                    ps.setString( 8, Serializer.serializeToBase64( profile.getAttributes() ) );
                }
                catch ( IOException e )
                {
                    throw new WikiSecurityException( "Could not save user profile attribute. Reason: " + e.getMessage(), e );
                }
                ps.setTimestamp( 9, ts );
                ps.execute();
                ps.close();

                // Insert new role record
                ps = conn.prepareStatement( m_findRoles );
                ps.setString( 1, profile.getLoginName() );
                ResultSet rs = ps.executeQuery();
                int roles = 0;
                while ( rs.next() )
                {
                    roles++;
                }
                ps.close();
                if( roles == 0 )
                {
                    ps = conn.prepareStatement( m_insertRole );
                    ps.setString( 1, profile.getLoginName() );
                    ps.setString( 2, m_initialRole );
                    ps.execute();
                    ps.close();
                }

                // Set the profile creation time
                profile.setCreated( modDate );
            }
            else
            {
                // User exists: modify existing record
                ps = conn.prepareStatement( m_updateProfile );
                ps.setString( 1, profile.getUid() );
                ps.setString( 2, profile.getEmail() );
                ps.setString( 3, profile.getFullname() );
                ps.setString( 4, password );
                ps.setString( 5, profile.getWikiName() );
                ps.setTimestamp( 6, ts );
                ps.setString( 7, profile.getLoginName() );
                try
                {
                    ps.setString( 8, Serializer.serializeToBase64( profile.getAttributes() ) );
                }
                catch ( IOException e )
                {
                    throw new WikiSecurityException( "Could not save user profile attribute. Reason: " + e.getMessage(), e );
                }
                ps.setDate( 9, lockExpiry );
                ps.setString( 10, profile.getLoginName() );
                ps.execute();
                ps.close();
            }
            // Set the profile mod time
            profile.setLastModified( modDate );

            // Commit and close connection
            if( m_supportsCommits )
            {
                conn.commit();
            }
        }
        catch( SQLException e )
        {
            throw new WikiSecurityException( e.getMessage(), e );
        }
        finally
        {
            try
            {
View Full Code Here

TOP

Related Classes of org.apache.wiki.auth.WikiSecurityException

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.