// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package com.oliodevices.assist.app.detectors.web.api; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.AsyncTask; import java.io.PrintStream; import org.apache.oltu.oauth2.client.OAuthClient; import org.apache.oltu.oauth2.client.URLConnectionClient; import org.apache.oltu.oauth2.client.request.OAuthClientRequest; import org.apache.oltu.oauth2.client.response.OAuthJSONAccessTokenResponse; import org.apache.oltu.oauth2.common.exception.OAuthProblemException; import org.apache.oltu.oauth2.common.exception.OAuthSystemException; import org.apache.oltu.oauth2.common.message.types.GrantType; import org.apache.oltu.oauth2.common.token.OAuthToken; public class OlioAuthenticator { public class AccessOauthToken extends AsyncTask { private AuthenticationCompleteHandler completeHandler; final OlioAuthenticator this$0; protected volatile Object doInBackground(Object aobj[]) { return doInBackground((Intent[])aobj); } protected transient OAuthToken doInBackground(Intent aintent[]) { aintent = aintent[0].getData(); if (aintent == null || !aintent.toString().startsWith(redirectURI)) { break MISSING_BLOCK_LABEL_125; } aintent = aintent.getQueryParameter("code"); System.out.println(aintent); aintent = OAuthClientRequest.tokenLocation(tokenUrl).setGrantType(GrantType.AUTHORIZATION_CODE).setClientId(clientId).setClientSecret(clientSecret).setRedirectURI(redirectURI).setCode(aintent).buildBodyMessage(); aintent = (new OAuthClient(new URLConnectionClient())).accessToken(aintent).getOAuthToken(); return aintent; aintent; try { aintent.printStackTrace(); } // Misplaced declaration of an exception variable catch (Intent aintent[]) { aintent.printStackTrace(); } return null; } protected volatile void onPostExecute(Object obj) { onPostExecute((OAuthToken)obj); } protected void onPostExecute(OAuthToken oauthtoken) { if (oauthtoken != null && oauthtoken.getAccessToken() != null) { completeHandler.onAuthenticationSuccess(oauthtoken); return; } else { completeHandler.onAuthenticationFailure(); return; } } public AccessOauthToken(AuthenticationCompleteHandler authenticationcompletehandler) { this$0 = OlioAuthenticator.this; super(); completeHandler = authenticationcompletehandler; } } public abstract class AuthenticationCompleteHandler { final OlioAuthenticator this$0; public abstract void onAuthenticationFailure(); public abstract void onAuthenticationSuccess(OAuthToken oauthtoken); public AuthenticationCompleteHandler() { this$0 = OlioAuthenticator.this; super(); } } private String authorizationLocation; private String clientId; private String clientSecret; private String redirectURI; private String tokenUrl; public OlioAuthenticator(String s, String s1, String s2, String s3, String s4) { clientId = s; clientSecret = s1; authorizationLocation = s2; redirectURI = s3; tokenUrl = s4; } public void completeLogin(Intent intent, AuthenticationCompleteHandler authenticationcompletehandler) { (new AccessOauthToken(authenticationcompletehandler)).execute(new Intent[] { intent }); } public void startLogin(Context context) { try { OAuthClientRequest oauthclientrequest = OAuthClientRequest.authorizationLocation(authorizationLocation).setClientId(clientId).setRedirectURI(redirectURI).buildQueryMessage(); context.startActivity(new Intent("android.intent.action.VIEW", Uri.parse((new StringBuilder()).append(oauthclientrequest.getLocationUri()).append("&response_type=code").toString()))); return; } // Misplaced declaration of an exception variable catch (Context context) { context.printStackTrace(); } } }