Package org.springframework.security

Examples of org.springframework.security.Authentication


            return true;
        }
       
        boolean result = true;
       
        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        ConfigAttributeDefinition config = new ConfigAttributeDefinition(new String[] {Authority.ROLE_FOUSER});
        try {
            _accessDecisionManager.decide(authentication, page, config);
        } catch (AccessDeniedException ex) {
            result = false;
View Full Code Here


    private ComponentResources _resources;

    private boolean _test;

    private boolean checkPermission() {
        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        if (((null == _roles) || "".equals(_roles))) {
            return (authentication != null)? true : false;
        }

        String[] attributeTokens = StringUtils.delimitedListToStringArray(_roles, ",", " \t\r\n\f");
View Full Code Here

    boolean beforeRenderBody() {
        return test() != _negate;
    }

    private boolean test() {
        Authentication authentication =  SecurityContextHolder.getContext().getAuthentication();
        return authentication != null;
    }
View Full Code Here

  public String getClassForPageName() {
    return resources.getPageName().equalsIgnoreCase(pageName) ? "current_page_item" : null;
  }

  public String[] getPageNames() {
    Authentication auth = SecurityContextHolder.getContext().getAuthentication();
//    if (auth == null) {
//      return new String[] { "Login", "Index", "admin/CreateRole", "admin/CreateUser", "teacher/InputScores", "teacher/ViewStudentScores",
//              "student/ViewScores" };
//    } else {
//      return new String[] { "Logout", "Index", "admin/CreateRole", "admin/CreateUser", "teacher/InputScores", "teacher/ViewStudentScores",
View Full Code Here

  @Inject
  private Block scoreListBlock;

  @SetupRender
  void setupRender() {
    Authentication auth = SecurityContextHolder.getContext().getAuthentication();
    Account account = accountService.getByLoginName(auth.getName());
    studentId = account.getId();
  }
View Full Code Here

        // Attempt login
        UsernamePasswordAuthenticationToken request = new UsernamePasswordAuthenticationToken(getUsername(),
                getPassword());

        Authentication result = null;

        try {
            result = authenticationManager.authenticate(request);
        } catch( SpringSecurityException e ) {
            logger.warn( "authentication failed", e);
View Full Code Here

        // Fire application event to advise of new login
        appCtx.publishEvent(new LoginEvent(result));
    }

    public static Authentication logout() {
        Authentication existing = SecurityContextHolder.getContext().getAuthentication();

        // Make the Authentication object null if a SecureContext exists
        SecurityContextHolder.getContext().setAuthentication(null);

        // Create a non-null Authentication object if required (to meet
View Full Code Here

     * security context, if any.
     */
    public LoginDetails() {
        // Retrieve any existing login information and install it
        ApplicationSecurityManager sm = (ApplicationSecurityManager)ApplicationServicesLocator.services().getService(ApplicationSecurityManager.class);
        Authentication authentication = sm.getAuthentication();
        if( authentication != null ) {
            setUsername( authentication.getName() );
        }
        initRules();
    }
View Full Code Here

        }

        dialog = new TitledPageApplicationDialog( tabbedPage ) {
            protected boolean onFinish() {
                loginForm.commit();
                Authentication authentication = loginForm.getAuthentication();

                // Hand this token to the security manager to actually attempt the login
                ApplicationSecurityManager sm = (ApplicationSecurityManager)getService(ApplicationSecurityManager.class);
                try {
                    sm.doLogin( authentication );
                    postLogin();
                    return true;
                } finally {
                    if( isClearPasswordOnFailure() ) {
                        loginForm.setPassword("");
                    }
                    loginForm.requestFocusInWindow();
                }
            }

            protected void onCancel() {
                super.onCancel(); // Close the dialog

                // Now exit if configured
                if( isCloseOnCancel() ) {
                    ApplicationSecurityManager sm = (ApplicationSecurityManager)getService(ApplicationSecurityManager.class);
                    Authentication authentication = sm.getAuthentication();
                    if( authentication == null ) {
                        LoginCommand.this.logger.info( "User canceled login; close the application." );
                        getApplication().close();
                    }
                }
View Full Code Here

     */
    public void onApplicationEvent(ApplicationEvent event) {

        // All events we care about are subtypes of ClientSecurityEvent
        if( event instanceof ClientSecurityEvent ) {
            Authentication authentication = (Authentication) event.getSource();

            if( logger.isDebugEnabled() ) {
                logger.debug( "RECEIVED ClientSecurityEvent: " + event );
                logger.debug( "Authentication token: " + authentication );
            }
View Full Code Here

TOP

Related Classes of org.springframework.security.Authentication

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.