Package org.openmhealth.reference.domain

Examples of org.openmhealth.reference.domain.AuthenticationToken


                final ResultSet resultSet,
                final int rowNum)
                throws SQLException {
               
                return
                  new AuthenticationToken(
                    resultSet
                      .getString(
                        AuthenticationToken
                          .JSON_KEY_TOKEN),
                    resultSet
View Full Code Here


    if(! user.isActivated()) {
      throw new OmhException("The account has not been activated.");
    }
   
    // Create the user's authentication token.
    AuthenticationToken token = new AuthenticationToken(user);
   
    // Save the token.
    AuthenticationTokenBin.getInstance().storeToken(token);
   
    // Return the token to the user.
View Full Code Here

    }
   
    // If we found a token, store it.
    if(authToken != null) {
      // Attempt to get the authentication token.
      AuthenticationToken authTokenObject =
        AuthenticationTokenBin.getInstance().getToken(authToken);
      if(authTokenObject == null) {
        throw
          new InvalidAuthenticationException(
            "The authentication token is unknown or has expired.");
View Full Code Here

    final HttpServletRequest request,
    final HttpServletResponse response)
    throws OmhException {
   
    // Create the authentication request from parameters.
    AuthenticationToken token =
      handleRequest(
        request,
        response,
        new AuthenticationRequest(username, password));
   
    // Add a cookie for the authentication token.
    Cookie cookie =
      new Cookie(PARAM_AUTHENTICATION_AUTH_TOKEN, token.getToken());
    // Set the expiration on the cookie.
    cookie
      .setMaxAge(
        new Long(
          (token.getExpires() - System.currentTimeMillis()) / 1000)
        .intValue());
    // Build the path without the "auth" part.
    String requestUri = request.getRequestURI();
    cookie.setPath(requestUri.substring(0, requestUri.length() - 5));
    // Make sure the cookie is only used with HTTPS.
    cookie.setSecure(true);
    // Add the cookie to the response.
    response.addCookie(cookie);
   
    // Return the token.
    return token.getToken();
  }
View Full Code Here

          "To upload data, the authentication token is required " +
            "as a parameter.");
    }
   
    // Get the authentication token.
    AuthenticationToken authToken =
      (AuthenticationToken)
        request
          .getAttribute(
            AuthFilter.ATTRIBUTE_AUTHENTICATION_TOKEN);
   
View Full Code Here

TOP

Related Classes of org.openmhealth.reference.domain.AuthenticationToken

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.