Package org.springframework.security

Examples of org.springframework.security.AccessDeniedException


    private void loginWithBadCredentials() {
        throw new BadCredentialsException("Wrong username/password");
    }

    private void denyAccess() {
        throw new AccessDeniedException("You don't have access to do this");
    }
View Full Code Here


    doPost(req, resp);
  }

  @Override
  protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws /* ServletException, */IOException {
    AccessDeniedException ade =
        (AccessDeniedException) req.getAttribute(AccessDeniedHandlerImpl.SPRING_SECURITY_ACCESS_DENIED_EXCEPTION_KEY);
    assert ade != null;
    resp.setContentType("text/html");
    resp.getWriter().write(ade.getMessage());
  }
View Full Code Here

        }

        public void decide(Authentication authentication, Object object, ConfigAttributeDefinition config)
                throws AccessDeniedException {
            if( !decisionValue) {
                throw new AccessDeniedException( "access denied" );
            }
        }
View Full Code Here

  @Override
  public RepositoryFile createFile( final Serializable parentFolderId, final RepositoryFile file,
      final IRepositoryFileData data, final RepositoryFileAcl acl, final String versionMessage ) {
    Validate.isTrue( !file.isFolder() );
    if ( !hasAccess( parentFolderId, EnumSet.of( WRITE ) ) ) {
      throw new AccessDeniedException( "access denied" );
    }
    FileRecord parentFolder = idManager.getFileById( parentFolderId );
    RepositoryFile fileFromRepo =
        new RepositoryFile.Builder( file ).path( parentFolder.getPath() + RepositoryFile.SEPARATOR + file.getName() )
            .title( findTitle( file ) ).description( findDesc( file ) ).build();
View Full Code Here

  public RepositoryFile createFolder( final Serializable parentFolderId, final RepositoryFile file,
      final RepositoryFileAcl acl, final String versionMessage ) {
    Validate.isTrue( file.isFolder() );
    Validate.isTrue( !file.isVersioned() );
    if ( !hasAccess( parentFolderId, EnumSet.of( WRITE ) ) ) {
      throw new AccessDeniedException( "access denied" );
    }
    FileRecord parentFolder = idManager.getFileById( parentFolderId );
    RepositoryFile fileFromRepo =
        new RepositoryFile.Builder( file ).path(
            parentFolder.getPath()
View Full Code Here

  @Override
  public RepositoryFile updateFile( final RepositoryFile file, final IRepositoryFileData data,
      final String versionMessage ) {
    Validate.isTrue( !file.isFolder() );
    if ( !hasAccess( file.getId(), EnumSet.of( WRITE ) ) ) {
      throw new AccessDeniedException( "access denied" );
    }
    FileRecord fileRecord = idManager.getFileById( file.getId() );
    fileRecord.setFile( new RepositoryFile.Builder( file ).title( findTitle( file ) ).description( findDesc( file ) )
        .build() );
    IRepositoryFileData oldData = fileRecord.getData();
View Full Code Here

  private void orphanFile( final Serializable fileId ) {
    FileRecord r = idManager.getFileById( fileId );
    FileRecord parentFolder = r.getParent();
    if ( !hasAccess( parentFolder.getFile().getId(), EnumSet.of( WRITE ) ) ) {
      throw new AccessDeniedException( "access denied" );
    }
    parentFolder.orphan( r.getFile().getName() );
  }
View Full Code Here

  @Override
  public void undeleteFile( final Serializable fileId, final String versionMessage ) {
    FileRecord r = idManager.getFileById( fileId );
    FileRecord parentFolder = r.getParent();
    if ( !hasAccess( parentFolder.getFile().getId(), EnumSet.of( WRITE ) ) ) {
      throw new AccessDeniedException( "access denied" );
    }
    deleteManager.restore( fileId );
  }
View Full Code Here

  }

  @Override
  public RepositoryFileAcl getAcl( final Serializable fileId ) {
    if ( !hasAccess( fileId, EnumSet.of( READ ) ) ) {
      throw new AccessDeniedException( "access denied" );
    }
    FileRecord r = idManager.getFileById( fileId );
    return r.getAcl();
  }
View Full Code Here

  }

  @Override
  public RepositoryFileAcl updateAcl( final RepositoryFileAcl acl ) {
    if ( !hasAccess( acl.getId(), EnumSet.of( WRITE ) ) ) {
      throw new AccessDeniedException( "access denied" );
    }
    FileRecord r = idManager.getFileById( acl.getId() );
    r.setAcl( acl );
    return acl;
  }
View Full Code Here

TOP

Related Classes of org.springframework.security.AccessDeniedException

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.