Hi,
If I have an unversioned API, the setup works. Authentication mode is set to JWT. There is a policy with access rights to that API. Requests get allowed or not based on whether the JWT is valid (i.e., signed correctly and has a policy claim that matches the ID of the policy with access to the API in question).
However, as soon as I version that API, I get
“Access to this API has been disallowed”
as a response.
The policy was adjusted to have access rights to the versions of the API.
These are the according log statements:
level=info msg="Attempted access to unauthorised API version." api_found=true key=587cf8f49411a405591e41b7184ca5a27caca5cc49856114e651043e origin=**** path="/drowsy/helloworld" version_found=false level=error msg="request error: Access to this API has been disallowed" api_id=be3af4efed9c483d6b39410f784a94bb org_id=587cf8f49411a405591e41b7 path="/helloworld" server_name="http://my-server:8080/" user_id="****043e" user_ip=****
This is in the policy:
"access_rights" : {
"be3af4efed9c483d6b39410f784a94bb" : {
"apiname" : "My API IGR",
"apiid" : "be3af4efed9c483d6b39410f784a94bb",
"versions" : [
"v1",
"v2"
],
"allowed_urls" : []
}
},
This is an excerpt from the API:
{
"_id" : ObjectId("587cfdd99411a405591e41b8"),
"name" : "My API IGR",
"slug" : "0",
"api_id" : "be3af4efed9c483d6b39410f784a94bb",
"org_id" : "587cf8f49411a405591e41b7",
"use_keyless" : false,
"use_oauth2" : false,
"use_openid" : false,
"openid_options" : {
"providers" : [],
"segregate_by_client" : false
},
"oauth_meta" : {
"allowed_access_types" : [],
"allowed_authorize_types" : [],
"auth_login_redirect" : ""
},
"auth" : {
"use_param" : false,
"param_name" : "",
"use_cookie" : false,
"cookie_name" : "",
"auth_header_name" : "Authorization"
},
"use_basic_auth" : false,
"enable_jwt" : true,
"use_standard_auth" : false,
"enable_coprocess_auth" : false,
"jwt_signing_method" : "hmac",
"jwt_source" : "QXZ5empQcURuQWRKYUFke3lbUWc9THlDZCNnYTZ6KkZhS01iQlQ3dEJIQks/bkhLTFg=",
"jwt_identit_base_field" : "sub",
"jwt_client_base_field" : "",
"jwt_policy_field_name" : "policy",
"notifications" : {
"shared_secret" : "",
"oauth_on_keychange_url" : ""
},
"enable_signature_checking" : false,
"hmac_allowed_clock_skew" : -1.0,
"base_identity_provided_by" : "",
"definition" : {
"location" : "header",
"key" : "x-api-version"
},
"version_data" : {
"not_versioned" : false,
"versions" : {
"djE=" : {
"name" : "djE=",
"expires" : "",
"paths" : {
"ignored" : [],
"white_list" : [],
"black_list" : []
},
"use_extended_paths" : true,
"extended_paths" : {
"ignored" : [],
"white_list" : [],
"black_list" : [],
"cache" : [],
"transform" : [],
"transform_response" : [],
"transform_headers" : [],
"transform_response_headers" : [],
"hard_timeouts" : [],
"circuit_breakers" : [],
"url_rewrites" : [],
"virtual" : [],
"size_limits" : [],
"method_transforms" : [],
"track_endpoints" : [],
"do_not_track_endpoints" : []
},
"global_headers" : {},
"global_headers_remove" : [],
"global_size_limit" : NumberLong(0),
"override_target" : "http://my-server:8080/"
},
"djI=" : {
"name" : "djI=",
"expires" : "",
"paths" : {
"ignored" : [],
"white_list" : [],
"black_list" : []
},
"use_extended_paths" : true,
"extended_paths" : {
"ignored" : [],
"white_list" : [],
"black_list" : [],
"cache" : [],
"transform" : [],
"transform_response" : [],
"transform_headers" : [],
"transform_response_headers" : [],
"hard_timeouts" : [],
"circuit_breakers" : [],
"url_rewrites" : [],
"virtual" : [],
"size_limits" : [],
"method_transforms" : [],
"track_endpoints" : [],
"do_not_track_endpoints" : []
},
"global_headers" : {},
"global_headers_remove" : [],
"global_size_limit" : NumberLong(0),
"override_target" : "http://my-server:8080/"
}
}
},
[...]
}
First I thought that the version_found=false
part in the logs insinuate that something is wrong with the version information in the request. However, if I change it to something that does not exist I get the following response:
“This API version does not seem to exist”
Any clues?