Package spanishgringo.logic

Examples of spanishgringo.logic.AuthManager


    // switch between both authroization methods simply replace retrieving a AuthManager
    // instance with the getOauthManager method for the getAuthSubManager method. This can be
    // done by uncommenting the code below. There is a similar change that must occur in the
    // MainServlet class.

    AuthManager authManager = AuthManagerFactory.getAuthSubManager();
    //AuthManager authManager = AuthManagerFactory.getOauthManager();
    String nextUrl = "";

    if (request.getParameter(authManager.getTokenParam()) != null) {
      // The user is being redirected back from google.com to exchange the AuthSub one time
      // use token for a session token.
      authManager.storeAuthorizedToken(request.getQueryString());
      nextUrl = MainServlet.MAIN_URL;

    } else if (request.getParameter("action") != null) {

      if (request.getParameter("action").equals("revoke")) {
        // The user is revoking their token.
        authManager.revokeToken();
        nextUrl = MainServlet.MAIN_URL;

      } else if (request.getParameter("action").equals("authorize")) {
        // The user is starting the AuthSub authorization process.
        nextUrl = authManager.getAuthorizationRedirectUrl(request.getRequestURL());
      }
    }

    GoogleData googleData = authManager.getGoogleData();

    if (googleData.getAuthorizationErrorMessage() != null) {
      // Forward users to the authorization page.
      request.setAttribute("googleData", googleData);
      ServletContext sc = getServletContext();
View Full Code Here

TOP

Related Classes of spanishgringo.logic.AuthManager

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.