package com.worklight.wlclient.challengehandler;

import android.content.Context;
import android.content.Intent;
import com.worklight.common.Logger;
import com.worklight.common.security.AppAuthenticityToken;
import com.worklight.nativeandroid.common.WLUtils;
import com.worklight.wlclient.api.WLClient;
import com.worklight.wlclient.api.challengehandler.WLChallengeHandler;
import com.worklight.wlclient.ui.UIActivity;
import java.util.ResourceBundle;
import org.json.JSONException;
import org.json.JSONObject;

public class AuthenticityChallengeHandler extends WLChallengeHandler
{
  private static final String AUTH_FAIL_ID = "WLClient.authFailure";
  private static final String CLOSE_ID = "WLClient.close";
  private static final String INIT_FAILURE_TITLE_ID = "WLClient.wlclientInitFailure";
  private static final String RESOURCE_BUNDLE = "com/worklight/wlclient/messages";
  private static Logger logger = Logger.getInstance("AuthenticityChallengeHandler");

  public AuthenticityChallengeHandler(String paramString)
  {
    super(paramString);
  }

  public void handleChallenge(JSONObject paramJSONObject)
  {
    try
    {
      String str = paramJSONObject.getString("WL-Challenge-Data");
      submitChallengeAnswer(new AppAuthenticityToken().a1(WLClient.getInstance().getContext(), str.substring(0, str.indexOf('+'))));
      return;
    }
    catch (JSONException localJSONException)
    {
      logger.debug(localJSONException.getMessage());
    }
  }

  public void handleFailure(JSONObject paramJSONObject)
  {
    ResourceBundle localResourceBundle = WLUtils.getMessagesBundle();
    Context localContext = WLClient.getInstance().getContext();
    Intent localIntent = new Intent(localContext, UIActivity.class);
    localIntent.putExtra("action", "exit");
    localIntent.putExtra("dialogue_message", localResourceBundle.getString("WLClient.authFailure"));
    localIntent.putExtra("dialogue_title", localResourceBundle.getString("WLClient.wlclientInitFailure"));
    localIntent.putExtra("positive_button_text", localResourceBundle.getString("WLClient.close"));
    localContext.startActivity(localIntent);
  }

  public void handleSuccess(JSONObject paramJSONObject)
  {
  }
}

/* Location:           C:\Documents and Settings\Cesar Cabello Cea\Mis documentos\Downloads\apk-downloader\com.ikea.kompis-6_dex2jar.jar
 * Qualified Name:     com.worklight.wlclient.challengehandler.AuthenticityChallengeHandler
 * JD-Core Version:    0.6.2
 */