AuthorizationRequestFactory.java 1.78 KB
package com.bitstrips.imoji.monouser.oauth2;

import android.support.annotation.NonNull;
import android.util.Base64;
import com.bitstrips.imoji.monouser.models.AuthorizationRequest;
import com.bitstrips.imoji.monouser.models.OAuth2Constants;
import java.security.MessageDigest;
import java.security.SecureRandom;

public class AuthorizationRequestFactory
{
  private static String a = "AuthRequestFactory";
  private static int b = 32;
  private static int c = 32;
  
  private static String a(int paramInt)
  {
    byte[] arrayOfByte = new byte[paramInt];
    new SecureRandom().nextBytes(arrayOfByte);
    return Base64.encodeToString(arrayOfByte, 11);
  }
  
  private static String a(@NonNull String paramString)
  {
    try
    {
      Object localObject = MessageDigest.getInstance("SHA-256");
      ((MessageDigest)localObject).update(paramString.getBytes("US-ASCII"));
      localObject = Base64.encodeToString(((MessageDigest)localObject).digest(), 11);
      return (String)localObject;
    }
    catch (Exception localException) {}
    return paramString;
  }
  
  public static AuthorizationRequest generateRequest(boolean paramBoolean)
  {
    String str1 = a(c);
    String str2 = a(str1);
    String str3 = a(b);
    return new AuthorizationRequest().withResponseType(OAuth2Constants.OAUTH2_RESPONSE_TYPE).withClientId(OAuth2Constants.getClientId(paramBoolean)).withScope(OAuth2Constants.OAUTH2_SCOPE).withRedirectUri(OAuth2Constants.OAUTH2_REDIRECT_URI).withCodeChallengeMethod(OAuth2Constants.OAUTH2_CODE_CHALLENGE_METHOD).withCodeVerifier(str1).withCodeChallenge(str2).withState(str3);
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/com/bitstrips/imoji/monouser/oauth2/AuthorizationRequestFactory.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */