Exemplo n.º 1
0
        public override Task <string> FetchTokenAsync(string url = null)
        {
            var tcs = new TaskCompletionSource <string>();
            var cb  = new TokenCB(tcs);

            ApproovAttestation.Shared().FetchApproovToken(cb, url);

            return(tcs.Task);
        }
Exemplo n.º 2
0
        public string fetchToken(string uri)
        {
            TokenInterfaceApproovResults
                results = ApproovAttestation.Shared().FetchApproovTokenAndWait(uri);

            if (results.Result == ApproovAttestation.AttestationResult.Success)
            {
                return(results.Token);
            }
            else
            {
                return(Approover.TOKEN_FAILURE);
            }
        }
Exemplo n.º 3
0
 /**
  * Create an Android Approov object.
  *
  * At application startup, create an AndroidApproov object and assign
  * it as the Approov Shared singleton. In the MainApplication's
  * OnCreate() method, add:
  *
  *     Approov.Shared = new AndroidApproov(this.ApplicationContext);
  *
  * @param context The application context.
  */
 public AndroidApproov(Context context) : base()
 {
     // Initialize the Approov SDK
     try
     {
         // Creates the configuration object for the Approov SDK based
         // on the Android application context
         ApproovConfig config = ApproovConfig.GetDefaultConfig(context);
         ApproovAttestation.Initialize(config);
     }
     catch (Exception ex)
     {
         Log.Error(TAG, ex.Message);
     }
 }
Exemplo n.º 4
0
        public override string FetchToken(string url)
        {
            TokenInterfaceApproovResults
                results = ApproovAttestation.Shared().FetchApproovTokenAndWait(url);

            if (results.Result == ApproovAttestation.AttestationResult.Success)
            {
                Log.Info(TAG, "Fetched Approov token");
                return(results.Token);
            }
            else
            {
                Log.Info(TAG, "Failed to fetch Approov token");
                return(ErrorToken);
            }
        }
Exemplo n.º 5
0
 public override void ClearCerts()
 {
     ApproovAttestation.Shared().ClearCerts();
     Log.Info(TAG, "Cleared certificate cache");
 }
Exemplo n.º 6
0
 public override byte[] GetCert(string url)
 {
     return(ApproovAttestation.Shared().GetCert(url));
 }
Exemplo n.º 7
0
 public override void SetTokenPayloadValue(string value)
 {
     ApproovAttestation.Shared().SetTokenPayloadValue(value);
 }