internal FirebaseTokenVerifier(FirebaseTokenVerifierArgs args) { this.ProjectId = args.ProjectId.ThrowIfNullOrEmpty(nameof(args.ProjectId)); this.shortName = args.ShortName.ThrowIfNullOrEmpty(nameof(args.ShortName)); this.operation = args.Operation.ThrowIfNullOrEmpty(nameof(args.Operation)); this.url = args.Url.ThrowIfNullOrEmpty(nameof(args.Url)); this.issuer = args.Issuer.ThrowIfNullOrEmpty(nameof(args.Issuer)); this.clock = args.Clock ?? SystemClock.Default; this.keySource = args.PublicKeySource.ThrowIfNull(nameof(args.PublicKeySource)); this.invalidTokenCode = args.InvalidTokenCode; this.expiredIdTokenCode = args.ExpiredTokenCode; if ("aeiou".Contains(this.shortName.ToLower().Substring(0, 1))) { this.articledShortName = $"an {this.shortName}"; } else { this.articledShortName = $"a {this.shortName}"; } this.TenantId = args.TenantId; if (this.TenantId == string.Empty) { throw new ArgumentException("Tenant ID must not be empty."); } }
private void CheckException( FirebaseAuthException exception, string prefix, AuthErrorCode errorCode = AuthErrorCode.InvalidSessionCookie) { Assert.Equal(ErrorCode.InvalidArgument, exception.ErrorCode); Assert.StartsWith(prefix, exception.Message); Assert.Equal(errorCode, exception.AuthErrorCode); Assert.Null(exception.InnerException); Assert.Null(exception.HttpResponse); }
public override void ViewDidLoad() { base.ViewDidLoad(); Auth.DefaultInstance.SignIn("*****@*****.**", "123456", (user, error) => { if (error != null) { AuthErrorCode errorCode = (AuthErrorCode)((long)error.Code); Console.WriteLine(errorCode); } else { Console.WriteLine("Success"); } } ); // Perform any additional setup after loading the view, typically from a nib. }
internal FirebaseTokenVerifier(FirebaseTokenVerifierArgs args) { this.ProjectId = args.ProjectId.ThrowIfNullOrEmpty(nameof(args.ProjectId)); this.shortName = args.ShortName.ThrowIfNullOrEmpty(nameof(args.ShortName)); this.operation = args.Operation.ThrowIfNullOrEmpty(nameof(args.Operation)); this.url = args.Url.ThrowIfNullOrEmpty(nameof(args.Url)); this.issuer = args.Issuer.ThrowIfNullOrEmpty(nameof(args.Issuer)); this.clock = args.Clock.ThrowIfNull(nameof(args.Clock)); this.keySource = args.PublicKeySource.ThrowIfNull(nameof(args.PublicKeySource)); this.invalidTokenCode = args.InvalidTokenCode; this.expiredIdTokenCode = args.ExpiredTokenCode; if ("aeiou".Contains(this.shortName.ToLower().Substring(0, 1))) { this.articledShortName = $"an {this.shortName}"; } else { this.articledShortName = $"a {this.shortName}"; } }
public void KnownErrorCodeWithDetails( string code, ErrorCode expectedCode, AuthErrorCode expectedAuthCode) { var json = $@"{{ ""error"": {{ ""message"": ""{code}: Some details."", }} }}"; var resp = new HttpResponseMessage() { StatusCode = HttpStatusCode.ServiceUnavailable, Content = new StringContent(json, Encoding.UTF8, "application/json"), }; var error = AuthErrorHandler.Instance.HandleHttpErrorResponse(resp, json); Assert.Equal(expectedCode, error.ErrorCode); Assert.Equal(expectedAuthCode, error.AuthErrorCode); Assert.Same(resp, error.HttpResponse); Assert.Null(error.InnerException); Assert.EndsWith($" ({code}): Some details.", error.Message); }
internal ErrorInfo(ErrorCode code, AuthErrorCode authCode, string message) { this.ErrorCode = code; this.AuthErrorCode = authCode; this.message = message; }
private FirebaseAuthException CreateException( string message, AuthErrorCode errorCode = AuthErrorCode.InvalidIdToken) { return(new FirebaseAuthException(ErrorCode.InvalidArgument, message, errorCode)); }
public AuthException(string message, AuthErrorCode code, System.Exception innerException) : base(message, innerException) { ErrorCode = code; }
public AuthException(string message, AuthErrorCode code) { ErrorCode = code; }