aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/security/jwt_verifier_test.c
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-07-13 08:41:49 -0700
committerGravatar Craig Tiller <ctiller@google.com>2015-07-13 08:41:49 -0700
commit143e7bf0cfcbfd60422f4e8f15e6b5c18259c8cd (patch)
treecbeb3f4da486b08a6cdae1be6754c523e2a361fb /test/core/security/jwt_verifier_test.c
parentf0fb537da9e67902f56b50d3d0f516b295609d88 (diff)
Introduce a clock type field onto gpr_timespec.
Use it to validate that arithmetic on time types makes even some vague kind of sense.
Diffstat (limited to 'test/core/security/jwt_verifier_test.c')
-rw-r--r--test/core/security/jwt_verifier_test.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/test/core/security/jwt_verifier_test.c b/test/core/security/jwt_verifier_test.c
index 46b96d9ecb..98db56c0ef 100644
--- a/test/core/security/jwt_verifier_test.c
+++ b/test/core/security/jwt_verifier_test.c
@@ -1,35 +1,35 @@
/*
- *
- * Copyright 2015, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
+*
+*Copyright 2015, Google Inc.
+*All rights reserved.
+*
+*Redistribution and use in source and binary forms, with or without
+*modification, are permitted provided that the following conditions are
+*met:
+*
+* * Redistributions of source code must retain the above copyright
+*notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+*copyright notice, this list of conditions and the following disclaimer
+*in the documentation and/or other materials provided with the
+*distribution.
+* * Neither the name of Google Inc. nor the names of its
+*contributors may be used to endorse or promote products derived from
+*this software without specific prior written permission.
+*
+*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+*A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+*OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+*SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+*LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+*DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+*THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+*(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+*OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
#include "src/core/security/jwt_verifier.h"
@@ -115,7 +115,7 @@ static const char good_jwk_set[] =
" ]"
"}";
-static gpr_timespec expected_lifetime = {3600, 0};
+static gpr_timespec expected_lifetime = {3600, 0, GPR_TIMESPAN};
static const char good_google_email_keys_part1[] =
"{\"e6b5137873db8d2ef81e06a47289e6434ec8a165\": \"-----BEGIN "
@@ -201,9 +201,9 @@ static void test_expired_claims_failure(void) {
gpr_slice s = gpr_slice_from_copied_string(expired_claims);
grpc_json *json = grpc_json_parse_string_with_len(
(char *)GPR_SLICE_START_PTR(s), GPR_SLICE_LENGTH(s));
- gpr_timespec exp_iat = {100, 0};
- gpr_timespec exp_exp = {120, 0};
- gpr_timespec exp_nbf = {60, 0};
+ gpr_timespec exp_iat = {100, 0, GPR_CLOCK_REALTIME};
+ gpr_timespec exp_exp = {120, 0, GPR_CLOCK_REALTIME};
+ gpr_timespec exp_nbf = {60, 0, GPR_CLOCK_REALTIME};
GPR_ASSERT(json != NULL);
claims = grpc_jwt_claims_from_json(json, s);
GPR_ASSERT(claims != NULL);