Package br.gov.frameworkdemoiselle.security

Examples of br.gov.frameworkdemoiselle.security.SecurityContext


    }
  }

  private boolean performLogin(String header, HttpServletRequest request) {
    boolean result = false;
    SecurityContext securityContext = Beans.getReference(SecurityContext.class);

    if (header != null) {
      String[] basicCredentials = getCredentials(header);

      Credentials credentials = Beans.getReference(Credentials.class);
      credentials.setUsername(basicCredentials[0]);
      credentials.setPassword(basicCredentials[1]);

      securityContext.login();
      result = securityContext.isLoggedIn();
    }

    return result;
  }
View Full Code Here


    }
  }

  private void login(HttpServletRequest request, HttpServletResponse response) {
    loadCredentials(request);
    SecurityContext securityContext = Beans.getReference(SecurityContext.class);

    try {
      securityContext.login();

      if (securityContext.isLoggedIn()) {
        response.setStatus(SC_OK);
      } else {
        response.setStatus(SC_FORBIDDEN);
      }
View Full Code Here

    }
  }

  private void logout(HttpServletRequest request, HttpServletResponse response) {
    loadCredentials(request);
    SecurityContext securityContext = Beans.getReference(SecurityContext.class);

    if (isLogon(request)) {
      securityContext.login();
    }

    try {
      securityContext.logout();
     
      if (!securityContext.isLoggedIn()) {
        response.setStatus(SC_OK);
      } else {
        response.setStatus(SC_EXPECTATION_FAILED);
      }
     
View Full Code Here

      setUnauthorizedStatus((HttpServletResponse) response, cause);
    }
  }

  private boolean performLogin(String header, HttpServletRequest request) {
    SecurityContext securityContext = Beans.getReference(SecurityContext.class);

    if (header != null) {
      String[] basicCredentials = getCredentials(header);

      Credentials credentials = Beans.getReference(Credentials.class);
      credentials.setUsername(basicCredentials[0]);
      credentials.setPassword(basicCredentials[1]);

      securityContext.login();
    }

    return securityContext.isLoggedIn();
  }
View Full Code Here

TOP

Related Classes of br.gov.frameworkdemoiselle.security.SecurityContext

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.