gravitee-io / issues

Gravitee.io - API Platform - Issues
64 stars 26 forks source link

[resource] [oauth2-am] Oauth2 plan with Gravitee IO AM resource doesnt work and throws unauthorized #1433

Closed sunilb20 closed 6 years ago

sunilb20 commented 6 years ago
  1. I have created an Oauth2 plan which points to the Gravitee AM resource created under design resources.
  2. Logged in as a user and created an application with the client id as given in Gravitee resource AM and Subscribed to the plan.
  3. Get the token from Auth server using client id and secret.
  4. Send a Authorization header having the bearer token from step3.

It still says Unauthorized 401

Version :1.16.3

sunilb20 commented 6 years ago
15:34:35.092 [rate-limit-poller] [] DEBUG o.s.jdbc.core.JdbcTemplate - Executing prepared SQL statement [select `key`, counter, last_request, reset_time, created_at, updated_at, async  from ratelimit  where async = true and updated_at > ?]
15:34:35.092 [rate-limit-poller] [] DEBUG o.s.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource
15:34:35.093 [rate-limit-poller] [] DEBUG o.s.jdbc.datasource.DataSourceUtils - Returning JDBC Connection to DataSource
15:34:35.134 [vert.x-eventloop-thread-3] [] DEBUG i.g.g.reactor.impl.DefaultReactor - Receiving a request 165158a0-7bd1-49cb-9158-a07bd1c9cbd6 for path /customerGatewayPlanTest/3
15:34:35.134 [vert.x-eventloop-thread-3] [] DEBUG i.g.g.r.h.i.DefaultReactorHandlerResolver - Returning the first handler matching path /customerGatewayPlanTest/3/ : ApiReactorHandler{contextPath=/customerGatewayPlanTest}
15:34:35.134 [vert.x-eventloop-thread-3] [] DEBUG i.g.g.s.c.SecurityPolicyChainResolver - Security provider [oauth2] has been selected to secure incoming request 165158a0-7bd1-49cb-9158-a07bd1c9cbd6
15:34:35.134 [vert.x-eventloop-thread-3] [] DEBUG i.g.g.policy.impl.PolicyFactoryImpl - Create a new policy instance for io.gravitee.policy.oauth2.Oauth2Policy
15:34:35.134 [vert.x-eventloop-thread-3] [] DEBUG i.g.g.p.impl.DefaultPolicyManager - Policy oauth2 has been added to the policy chain
15:34:35.134 [vert.x-eventloop-thread-3] [] DEBUG i.g.policy.oauth2.Oauth2Policy - Read access_token from request 165158a0-7bd1-49cb-9158-a07bd1c9cbd6
15:34:35.134 [vert.x-eventloop-thread-3] [] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'resourceLifecycleManager'
15:34:35.134 [vert.x-eventloop-thread-3] [] DEBUG i.g.r.oauth2.am.OAuth2AMResource - Introspect access token by requesting /test-domain/oauth/check_token
15:34:35.142 [vert.x-eventloop-thread-3] [] DEBUG i.g.r.oauth2.am.OAuth2AMResource - AM Introspection endpoint returns a response with a 200 status code
15:34:35.142 [vert.x-eventloop-thread-3] [] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'resourceLifecycleManager'
15:34:35.142 [vert.x-eventloop-thread-3] [] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'io.gravitee.repository.management.api.SubscriptionRepository'
15:34:35.153 [subscriptions-refresher-0] [] DEBUG i.g.g.s.s.task.SubscriptionRefresher - Refresh subscriptions for API id[42af7616-5487-4a77-af76-1654874a7709] name[GetCustomer_Plantest]
15:34:35.153 [subscriptions-refresher-0] [] DEBUG o.s.jdbc.core.JdbcTemplate - Executing prepared SQL query
15:34:35.153 [subscriptions-refresher-0] [] DEBUG o.s.jdbc.core.JdbcTemplate - Executing prepared SQL statement [select * from subscriptions  where created_at >= ? and created_at <= ? and ( plan in (?) )  and ( status in (?, ?) )  order by created_at desc ]
15:34:35.153 [subscriptions-refresher-0] [] DEBUG o.s.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource
15:34:35.154 [subscriptions-refresher-0] [] DEBUG o.s.jdbc.datasource.DataSourceUtils - Returning JDBC Connection to DataSource
15:34:35.154 [subscriptions-refresher-0] [] DEBUG i.g.g.s.s.task.SubscriptionRefresher - Cache a subscription: plan[bffc6777-16e1-44ce-bc67-7716e1c4ce97] application[bb45b69c-f283-424c-85b6-9cf283324c7d] client_id[1001]
15:34:36.121 [apikeys-refresher-2] [] DEBUG i.g.g.s.apikeyscache.ApiKeyRefresher - Refresh api-keys for API [name: GetCustomerDuplicate] [id: a3f7b64c-cc8e-4493-b7b6-4ccc8ed4937a]
15:34:36.121 [apikeys-refresher-2] [] DEBUG i.g.r.j.m.JdbcApiKeyRepository - JdbcApiKeyRepository.findByCriteria(io.gravitee.repository.management.api.search.ApiKeyCriteria@781bb2ae)
15:34:36.121 [apikeys-refresher-2] [] DEBUG o.s.jdbc.core.JdbcTemplate - Executing prepared SQL query
15:34:36.121 [apikeys-refresher-2] [] DEBUG o.s.jdbc.core.JdbcTemplate - Executing prepared SQL statement [select * from `keys`  where  ( plan in (  ? ) )  and  ( updated_at >= ? )  and  ( updated_at <= ? )  order by updated_at desc ]
15:34:36.121 [apikeys-refresher-2] [] DEBUG o.s.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource
15:34:36.123 [apikeys-refresher-2] [] DEBUG o.s.jdbc.datasource.DataSourceUtils - Returning JDBC Connection to DataSource
15:34:37.434 [gateway-monitor] [] DEBUG i.g.g.s.monitoring.MonitorThread - Run monitor for gateway at Tue Aug 21 15:34:37 IST 2018
15:34:37.434 [gateway-monitor] [] DEBUG i.g.g.s.monitoring.MonitorThread - Sending an heartbeat event
15:34:37.434 [gateway-monitor] [] DEBUG i.g.r.j.m.JdbcEventRepository - JdbcEventRepository.update(io.gravitee.repository.management.model.Event@29e62cae)
15:34:37.434 [gateway-monitor] [] DEBUG o.s.jdbc.core.JdbcTemplate - Executing prepared SQL update
15:34:37.434 [gateway-monitor] [] DEBUG o.s.jdbc.core.JdbcTemplate - Executing prepared SQL statement
15:34:37.434 [gateway-monitor] [] DEBUG o.s.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource
15:34:37.434 [gateway-monitor] [] DEBUG i.g.r.jdbc.orm.JdbcObjectMapper - Setting 1/id to 3907d251-0c5f-4c32-87d2-510c5f5c322a for the type -9
15:34:37.434 [gateway-monitor] [] DEBUG i.g.r.jdbc.orm.JdbcObjectMapper - Setting 2/created_at to Tue Aug 21 15:08:34 IST 2018 for the type 93
15:34:37.434 [gateway-monitor] [] DEBUG i.g.r.jdbc.orm.JdbcObjectMapper - Setting 3/type to GATEWAY_STARTED for the type -9
15:34:37.435 [gateway-monitor] [] DEBUG i.g.r.jdbc.orm.JdbcObjectMapper - Setting 4/payload to {"id":"6f17f060-025f-4fd5-97f0-60025fbfd525","version":"1.16.3 (build: 318) revision#ca142dd548d7dffd9e5c62231190dbc42df310bc","tags":null,"plugins":[{"id":"mock","name":"Mock","description":"Description of the Mock Gravitee Policy","version":"1.5.0","plugin":"io.gravitee.policy.mock.MockPolicy","type":"policy"},{"id":"policy-request-validation","name":"Validate Request","description":"Description of the validate HTTP request Policy","version":"1.0.0","plugin":"io.gravitee.policy.requestvalidation.RequestValidationPolicy","type":"policy"},{"id":"resource-filtering","name":"Resource Filtering","description":"Description of the Resource Filtering Gravitee Policy","version":"1.2.0","plugin":"io.gravitee.policy.resourcefiltering.ResourceFilteringPolicy","type":"policy"},{"id":"policy-openid-userinfo","name":"OpenID Connect - UserInfo","description":"Description of the OpenID Connect - UserInfo  Gravitee Policy","version":"1.0.0","plugin":"io.gravitee.policy.openid.userinfo.UserInfoPolicy","type":"policy"},{"id":"policy-override-request-method","name":"Override HTTP Method","description":"Description of the override HTTP request method Gravitee Policy","version":"1.0.0","plugin":"io.gravitee.policy.overriderequestmethod.OverrideRequestMethodPolicy","type":"policy"},{"id":"groovy","name":"Groovy","description":"Description of the Groovy Gravitee Policy","version":"1.7.0","plugin":"io.gravitee.policy.groovy.GroovyPolicy","type":"policy"},{"id":"xml-json","name":"XML to JSON","description":"Description of the XML to JSON Transformation  Gravitee Policy","version":"1.3.0","plugin":"io.gravitee.policy.xml2json.XmlToJsonTransformationPolicy","type":"policy"},{"id":"healthcheck","name":"Gravitee.io APIM - Gateway - Services - Health Check","description":"The Gravitee.IO Parent POM provides common settings for all Gravitee components.","version":"1.16.3","plugin":"io.gravitee.gateway.services.healthcheck.EndpointHealthcheckService","type":"service"},{"id":"key-less","name":"Keyless","description":"Description of the Keyless Security Gravitee Policy","version":"1.1.0","plugin":"io.gravitee.policy.keyless.KeylessPolicy","type":"policy"},{"id":"cache","name":"Cache","description":"Description of the Cache Gravitee Policy","version":"1.5.0","plugin":"io.gravitee.policy.cache.CachePolicy","type":"policy"},{"id":"json-to-json","name":"JSON to JSON Transformation","description":"Description of the JSON to JSON Transformation Gravitee Policy","version":"1.2.0","plugin":"io.gravitee.policy.json2json.JsonToJsonTransformationPolicy","type":"policy"},{"id":"jwt","name":"JSON Web Tokens","description":"Description of the JWT Gravitee Policy","version":"1.5.0","plugin":"io.gravitee.policy.jwt.JWTPolicy","type":"policy"},{"id":"repository-ehcache","name":"Gravitee IO - API Management - Repository EHCache","description":"The Gravitee.IO Parent POM provides common settings for all Gravitee components.","version":"1.0.0","plugin":"io.gravitee.repository.ehcache.EhCacheRepository","type":"repository"},{"id":"policy-assign-content","name":"Assign content","description":"Description of the Assign content Policy","version":"1.0.0","plugin":"io.gravitee.policy.assigncontent.AssignContentPolicy","type":"policy"},{"id":"api-key","name":"Api Key","description":"Description of the ApiKey Gravitee Policy","version":"1.5.0","plugin":"io.gravitee.policy.apikey.ApiKeyPolicy","type":"policy"},{"id":"rate-limit","name":"Rate Limit","description":"Description of the Rate Limit Gravitee Policy","version":"1.2.0","plugin":"io.gravitee.policy.ratelimit.RateLimitPolicy","type":"policy"},{"id":"oauth2","name":"Generic OAuth2 Authorization Server Resource","description":"The Gravitee.IO Parent POM provides common settings for all Gravitee components.","version":"1.9.0","plugin":"io.gravitee.resource.oauth2.generic.OAuth2GenericResource","type":"resource"},{"id":"rest-to-soap","name":"Rest to SOAP Transformer","description":"Description of the Rest to SOAP Transformer Policy","version":"1.3.0","plugin":"io.gravitee.policy.rest2soap.RestToSoapTransformerPolicy","type":"policy"},{"id":"monitoring","name":"Gravitee.io APIM - Gateway - Services - Monitoring","description":"The Gravitee.IO Parent POM provides common settings for all Gravitee components.","version":"1.16.3","plugin":"io.gravitee.gateway.services.monitoring.MonitoringService","type":"service"},{"id":"quota","name":"Quota","description":"Description of the Quota Gravitee Policy","version":"1.2.0","plugin":"io.gravitee.policy.quota.QuotaPolicy","type":"policy"},{"id":"oauth2-am-resource","name":"Gravitee.io AM Authorization Server Resource","description":"The Gravitee.IO Parent POM provides common settings for all Gravitee components.","version":"1.6.0","plugin":"io.gravitee.resource.oauth2.am.OAuth2AMResource","type":"resource"},{"id":"ip-filtering","name":"IPFiltering","description":"Filter IPs from remote address or X-Forwarded-For header with blacklist or whitelist","version":"1.2.0","plugin":"io.gravitee.policy.ipfiltering.IPFilteringPolicy","type":"policy"},{"id":"service-node-health-check","name":"Gravitee.io APIM - Gateway - Services - Node Health-check","description":"The Gravitee.IO Parent POM provides common settings for all Gravitee components.","version":"1.16.3","plugin":"io.gravitee.gateway.services.healthcheck.NodeHealthcheckService","type":"service"},{"id":"ratelimitasync","name":"Gravitee.io APIM - Gateway - Services - Rate Limit proxy","description":"Description of the Rate Limit Gravitee Policy","version":"1.2.0","plugin":"io.gravitee.gateway.service.ratelimit.AsyncRateLimitService","type":"service"},{"id":"latency","name":"Latency","description":"Description of the Latency Gravitee Policy","version":"1.0.0","plugin":"io.gravitee.policy.latency.LatencyPolicy","type":"policy"},{"id":"service-subscriptions-cache","name":"Gravitee.io APIM - Gateway - Services - Subscriptions cache","description":"The Gravitee.IO Parent POM provides common settings for all Gravitee components.","version":"1.16.3","plugin":"io.gravitee.gateway.services.subscriptionscache.SubscriptionsCacheService","type":"service"},{"id":"localregistry","name":"Gravitee.io APIM - Gateway - Services - Local Registry","description":"The Gravitee.IO Parent POM provides common settings for all Gravitee components.","version":"1.16.3","plugin":"io.gravitee.gateway.services.localregistry.LocalApiDefinitionRegistry","type":"service"},{"id":"sync","name":"Gravitee.io APIM - Gateway - Services - Sync","description":"The Gravitee.IO Parent POM provides common settings for all Gravitee components.","version":"1.16.3","plugin":"io.gravitee.gateway.services.sync.ScheduledSyncService","type":"service"},{"id":"repository-mongodb","name":"Gravitee.io APIM - Repository - MongoDB","description":"The Gravitee.IO Parent POM provides common settings for all Gravitee components.","version":"1.16.1","plugin":"io.gravitee.repository.mongodb.MongoRepository","type":"repository"},{"id":"cache","name":"Cache resource","description":"The Gravitee.IO Parent POM provides common settings for all Gravitee components.","version":"1.1.0","plugin":"io.gravitee.resource.cache.CacheResource","type":"resource"},{"id":"endpoint-discovery-consul","name":"Gravitee.io APIM - Gateway - Services - Endpoints Discovery - Consul.io","description":"The Gravitee.IO Parent POM provides common settings for all Gravitee components.","version":"1.16.3","plugin":"io.gravitee.gateway.services.endpoint.discovery.consul.EndpointDiscoveryConsulService","type":"service"},{"id":"xslt","name":"XSLT Transformation","description":"Description of the XSLT Gravitee Policy","version":"1.2.0","plugin":"io.gravitee.policy.xslt.XSLTTransformationPolicy","type":"policy"},{"id":"transform-headers","name":"Transform Headers","description":"Description of the Transform Headers Gravitee Policy","version":"1.3.1","plugin":"io.gravitee.policy.transformheaders.TransformHeadersPolicy","type":"policy"},{"id":"jws","name":"JSON Web Signature","description":"Description of the JWS Gravitee Policy","version":"1.0.0","plugin":"io.gravitee.policy.jws.JWSPolicy","type":"policy"},{"id":"apikeyscache","name":"Gravitee.io APIM - Gateway - Services - API Keys cache","description":"The Gravitee.IO Parent POM provides common settings for all Gravitee components.","version":"1.16.3","plugin":"io.gravitee.gateway.services.apikeyscache.ApiKeysCacheService","type":"service"},{"id":"repository-jdbc","name":"Gravitee.io APIM - Repository - JDBC","description":"The Gravitee.IO Parent POM provides common settings for all Gravitee components.","version":"1.16.0","plugin":"io.gravitee.repository.jdbc.JdbcRepository","type":"repository"},{"id":"html-json","name":"HTML to JSON","description":"The HTML to JSON Transformation Gravitee Policy allows to get a json by parsing an html content","version":"1.3.0","plugin":"io.gravitee.policy.html2Json.HTMLToJSONTransformationPolicy","type":"policy"},{"id":"transform-queryparams","name":"Transform Query Parameters","description":"Description of the Transform Query Parameters Policy","version":"1.2.0","plugin":"io.gravitee.policy.transformqueryparams.TransformQueryParametersPolicy","type":"policy"},{"id":"oauth2","name":"OAuth2","description":"Description of the OAuth2 Gravitee Policy","version":"1.6.1","plugin":"io.gravitee.policy.oauth2.Oauth2Policy","type":"policy"},{"id":"request-content-limit","name":"Request Content Limit","description":"Description of the Request Content Limit Gravitee Policy","version":"1.2.0","plugin":"io.gravitee.policy.rcl.RequestContentLimitPolicy","type":"policy"},{"id":"dynamic-routing","name":"Dynamic Routing","description":"Description of the Dynamic Routing Gravitee Policy","version":"1.3.1","plugin":"io.gravitee.policy.dynamicrouting.DynamicRoutingPolicy","type":"policy"},{"id":"elastic","name":"Gravitee.io APIM - Reporter - Elasticsearch","description":"The Gravitee.IO Parent POM provides common settings for all Gravitee components.","version":"1.16.0","plugin":"io.gravitee.reporter.elasticsearch.ElasticsearchReporter","type":"reporter"},{"id":"file","name":"Gravitee.io APIM - Reporter - File","description":"The Gravitee.IO Parent POM provides common settings for all Gravitee components.","version":"1.3.0","plugin":"io.gravitee.reporter.file.FileReporter","type":"reporter"}],"hostname":"SUNILB-TI10009","ip":"10.131.155.59","port":"8082","tenant":null,"systemProperties":{"sun.desktop":"windows","awt.toolkit":"sun.awt.windows.WToolkit","file.encoding.pkg":"sun.io","java.specification.version":"1.8","sun.cpu.isalist":"amd64","sun.jnu.encoding":"Cp1252","java.class.path":"E:\\Softwares\\gateways\\gravitee\\graviteeio-full-1.16.3\\graviteeio-gateway-1.16.3\\lib\\gravitee-gateway-standalone-bootstrap-1.16.3.jar;E:\\Softwares\\gateways\\gravitee\\graviteeio-full-1.16.3\\graviteeio-gateway-1.16.3\\/boot/jetty-alpn-agent-2.0.7.jar","java.vm.vendor":"Oracle Corporation","sun.arch.data.model":"64","user.variant":"","gravitee.conf":"E:\\Softwares\\gateways\\gravitee\\graviteeio-full-1.16.3\\graviteeio-gateway-1.16.3\\config\\gravitee.yml","java.vendor.url":"http://java.oracle.com/","user.timezone":"Asia/Calcutta","os.name":"Windows 10","java.vm.specification.version":"1.8","user.country":"US","sun.java.launcher":"SUN_STANDARD","sun.boot.library.path":"C:\\Program Files\\Java\\jdk1.8.0_66\\jre\\bin","sun.java.command":"io.gravitee.gateway.standalone.boostrap.Bootstrap ","sun.cpu.endian":"little","user.home":"C:\\Users\\sunil.bharadwaj","user.language":"en","sun.stderr.encoding":"cp437","java.specification.vendor":"Oracle Corporation","java.home":"C:\\Program Files\\Java\\jdk1.8.0_66\\jre","file.separator":"\\","line.separator":"\r\n","sun.stdout.encoding":"cp437","java.vm.specification.vendor":"Oracle Corporation","java.specification.name":"Java Platform API Specification","liquibase.databaseChangeLogLockTableName":"databasechangeloglock","java.awt.graphicsenv":"sun.awt.Win32GraphicsEnvironment","java.awt.headless":"true","logback.configurationFile":"E:\\Softwares\\gateways\\gravitee\\graviteeio-full-1.16.3\\graviteeio-gateway-1.16.3\\config\\logback.xml","sun.boot.class.path":"C:\\Program Files\\Java\\jdk1.8.0_66\\jre\\lib\\resources.jar;C:\\Program Files\\Java\\jdk1.8.0_66\\jre\\lib\\rt.jar;C:\\Program Files\\Java\\jdk1.8.0_66\\jre\\lib\\sunrsasign.jar;C:\\Program Files\\Java\\jdk1.8.0_66\\jre\\lib\\jsse.jar;C:\\Program Files\\Java\\jdk1.8.0_66\\jre\\lib\\jce.jar;C:\\Program Files\\Java\\jdk1.8.0_66\\jre\\lib\\charsets.jar;C:\\Program Files\\Java\\jdk1.8.0_66\\jre\\lib\\jfr.jar;C:\\Program Files\\Java\\jdk1.8.0_66\\jre\\classes","user.script":"","sun.management.compiler":"HotSpot 64-Bit Tiered Compilers","java.runtime.version":"1.8.0_66-b18","java.net.preferIPv4Stack":"true","user.name":"sunil.bharadwaj","path.separator":";","os.version":"10.0","java.endorsed.dirs":"C:\\Program Files\\Java\\jdk1.8.0_66\\jre\\lib\\endorsed","java.runtime.name":"Java(TM) SE Runtime Environment","file.encoding":"UTF-8","gravitee.home":"E:\\Softwares\\gateways\\gravitee\\graviteeio-full-1.16.3\\graviteeio-gateway-1.16.3","sun.nio.ch.bugLevel":"","java.vm.name":"Java HotSpot(TM) 64-Bit Server VM","io.netty.noJdkZlibDecoder":"false","java.vendor.url.bug":"http://bugreport.sun.com/bugreport/","java.io.tmpdir":"C:\\Users\\SUNIL~1.BHA\\AppData\\Local\\Temp\\","java.version":"1.8.0_66","user.dir":"E:\\Softwares\\gateways\\gravitee\\graviteeio-full-1.16.3\\graviteeio-gateway-1.16.3\\bin","os.arch":"amd64","java.vm.specification.name":"Java Virtual Machine Specification","java.awt.printerjob":"sun.awt.windows.WPrinterJob","sun.os.patch.level":"","liquibase.databaseChangeLogTableName":"databasechangelog","java.library.path":"C:\\Program Files\\Java\\jdk1.8.0_66\\bin;C:\\WINDOWS\\Sun\\Java\\bin;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\Program Files (x86)\\Intel\\iCLS Client\\;C:\\Program Files\\Intel\\iCLS Client\\;C:\\ProgramData\\Oracle\\Java\\javapath;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\TortoiseSVN\\bin;C:\\Program Files (x86)\\Windows Live\\Shared;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files\\Java\\jdk1.8.0_66\\bin;D:\\apache-maven-3.0.5-bin\\apache-maven-3.0.5\\bin;C:\\Program Files (x86)\\scala\\bin;C:\\Program Files (x86)\\scala\\bin;D:\\Softwares\\Spark\\spark-1.6.0-bin-hadoop2.6\\bin;C:\\Program Files\\Intel\\WiFi\\bin\\;C:\\Program Files\\Common Files\\Intel\\WirelessCommon\\;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\nodejs\\;C:\\Program Files\\Git\\cmd;E:\\Softwares\\consul;C:\\Users\\sunil.bharadwaj\\AppData\\Roaming\\npm;%USERPROFILE%\\AppData\\Local\\Microsoft\\WindowsApps;;.","java.vm.info":"mixed mode","java.vendor":"Oracle Corporation","java.vm.version":"25.66-b18","java.ext.dirs":"C:\\Program Files\\Java\\jdk1.8.0_66\\jre\\lib\\ext;C:\\WINDOWS\\Sun\\Java\\lib\\ext","sun.io.unicode.encoding":"UnicodeLittle","java.class.version":"52.0","vertx.disableFileCaching":"true"}} for the type -9
15:34:37.435 [gateway-monitor] [] DEBUG i.g.r.jdbc.orm.JdbcObjectMapper - Setting 5/parent_id to null for the type -9
15:34:37.435 [gateway-monitor] [] DEBUG i.g.r.jdbc.orm.JdbcObjectMapper - Setting 6/updated_at to Tue Aug 21 15:34:37 IST 2018 for the type 93
15:34:37.497 [gateway-monitor] [] DEBUG o.s.jdbc.core.JdbcTemplate - SQL update affected 1 rows
15:34:37.497 [gateway-monitor] [] DEBUG o.s.jdbc.datasource.DataSourceUtils - Returning JDBC Connection to DataSource
15:34:37.497 [gateway-monitor] [] DEBUG o.s.jdbc.core.JdbcTemplate - Executing prepared SQL update
15:34:37.497 [gateway-monitor] [] DEBUG o.s.jdbc.core.JdbcTemplate - Executing prepared SQL statement [delete from event_properties where event_id = ?]
15:34:37.497 [gateway-monitor] [] DEBUG o.s.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource
15:34:37.530 [gateway-monitor] [] DEBUG o.s.jdbc.core.JdbcTemplate - SQL update affected 3 rows
15:34:37.530 [gateway-monitor] [] DEBUG o.s.jdbc.datasource.DataSourceUtils - Returning JDBC Connection to DataSource
15:34:37.530 [gateway-monitor] [] DEBUG o.s.jdbc.core.JdbcTemplate - Executing SQL batch update [insert into event_properties ( event_id, property_key, property_value ) values ( ?, ?, ? )]
15:34:37.530 [gateway-monitor] [] DEBUG o.s.jdbc.core.JdbcTemplate - Executing prepared SQL statement [insert into event_properties ( event_id, property_key, property_value ) values ( ?, ?, ? )]
15:34:37.530 [gateway-monitor] [] DEBUG o.s.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource
15:34:37.530 [gateway-monitor] [] DEBUG o.s.jdbc.support.JdbcUtils - JDBC driver supports batch updates
15:34:37.695 [gateway-monitor] [] DEBUG o.s.jdbc.datasource.DataSourceUtils - Returning JDBC Connection to DataSource
15:34:37.695 [gateway-monitor] [] DEBUG i.g.r.j.m.JdbcEventRepository - JdbcEventRepository.findById(3907d251-0c5f-4c32-87d2-510c5f5c322a)
15:34:37.695 [gateway-monitor] [] DEBUG o.s.jdbc.core.JdbcTemplate - Executing prepared SQL query
15:34:37.695 [gateway-monitor] [] DEBUG o.s.jdbc.core.JdbcTemplate - Executing prepared SQL statement [select * from events e left join event_properties ep on e.id = ep.event_id where e.id = ?]
15:34:37.695 [gateway-monitor] [] DEBUG o.s.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource
15:34:37.699 [gateway-monitor] [] DEBUG o.s.jdbc.datasource.DataSourceUtils - Returning JDBC Connection to DataSource
15:34:37.700 [gateway-monitor] [] DEBUG i.g.g.s.m.probe.ProcessProbe - Unexpected exception
java.lang.IllegalArgumentException: java.lang.ClassCastException@32de8b31
        at sun.reflect.GeneratedMethodAccessor327.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at io.gravitee.gateway.services.monitoring.probe.ProcessProbe.getOpenFileDescriptorCount(ProcessProbe.java:78)
        at io.gravitee.gateway.services.monitoring.probe.ProcessProbe.processInfo(ProcessProbe.java:89)
        at io.gravitee.gateway.services.monitoring.MonitorThread.run(MonitorThread.java:74)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
15:34:37.701 [gateway-monitor] [] DEBUG i.g.g.s.m.probe.ProcessProbe - Unexpected exception
java.lang.IllegalArgumentException: java.lang.ClassCastException@227f30bc
        at sun.reflect.GeneratedMethodAccessor328.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at io.gravitee.gateway.services.monitoring.probe.ProcessProbe.getMaxFileDescriptorCount(ProcessProbe.java:63)
        at io.gravitee.gateway.services.monitoring.probe.ProcessProbe.processInfo(ProcessProbe.java:90)
        at io.gravitee.gateway.services.monitoring.MonitorThread.run(MonitorThread.java:74)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
15:34:40.001 [sync-1] [] DEBUG i.g.g.services.sync.SyncManager - Synchronization #313 started at 2018-08-21T10:04:40.001Z
brasseld commented 6 years ago

Which version of AM ?

sunilb20 commented 6 years ago

gravitee-am-gateway-standalone-2.0.0 and its other components

sunilb20 commented 6 years ago

The same version works well when creating an Keyless plan and Oauth2 Policy. But Oauth2 Plan has this issue.

brasseld commented 6 years ago

Hi @sunilb20,

It's probably relative to this issue : https://github.com/gravitee-io/issues/issues/1406

The AM v2 resource will be embedded in next APIM version (1.19.x)

neonlai commented 6 years ago

I encountered similar problem. Got error 401 when using OAuth2 to protect an API and try to use the access token to access the protected API.

I am using APIM 1.18.x and AM 2.0.3. May i know which previous version works for OAuth2 ?

brasseld commented 6 years ago

Hi @neonlai

Two solutions: 1) You use a previous version if AM (1.x) 2) You use latest version (2.0.4), but you have to build the plugin by yourself: https://github.com/gravitee-io/gravitee-resource-oauth2-provider-am latest version of plugin provides support for both AM 1.x and 2.x 3) You wait for the next APIM release (1.19) for mid-september: https://github.com/gravitee-io/issues/milestone/73

brasseld commented 6 years ago

@sunilb20 the stacktrace you've provided (https://github.com/gravitee-io/issues/issues/1433#issuecomment-414626504) is not relative to AM.

It seems that we are not able to access to metrics from the JVM. Which version of JDK are you using ?

brasseld commented 6 years ago

Here is a the nightly build of the plugin: gravitee-resource-oauth2-provider-am-1.7.0-SNAPSHOT.zip

neonlai commented 6 years ago

Hi David

Really appreciate your prompt reply. I will try and looking fwd to next APIM release

Brassely David notifications@github.com 於 2018年8月22日 下午2:53 寫道:

Hi @neonlai

Two solutions:

You use a previous version if AM (1.x) You use latest version (2.0.4), but you have to build the plugin by yourself: https://github.com/gravitee-io/gravitee-resource-oauth2-provider-am latest version of plugin provides support for both AM 1.x and 2.x You wait for the next APIM release (1.19) for mid-september: https://github.com/gravitee-io/issues/milestone/73 — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

sunilb20 commented 6 years ago

Cool!!! Let me work on to integrate the plugin and verify again. Thanks. Will keep you posted.

sunilb20 commented 6 years ago

Seems like I am able to authorize now. But need to change the existing resources, if created and a new field called 'version' is added in under resources which needs to be set as V2_X.

Please approve.

brasseld commented 6 years ago

You have to remove the old resource version by the new one. That's the only thing you have to do.

Am I right ?

sunilb20 commented 6 years ago

Yeah. Also Rate Limit doesnt work for Oauth2 plans when set in the Plan wizard. It works If I add a policy though. But then policy will be applicable to both the plans. But I wanted to set different rate limit for each plan. Still a defect ? or working on it ?

brasseld commented 6 years ago

When you say that it didn't work, do you have any error or stacktrace ?

sunilb20 commented 6 years ago

No Error. I have API metadata as well. { "methods" : [ "GET", "POST", "PUT", "DELETE", "HEAD", "PATCH", "OPTIONS", "TRACE", "CONNECT" ], "rate-limit" : {"async":false,"addHeaders":false,"rate":{"periodTime":1,"periodTimeUnit":"MINUTES","limit":5}}, "description" : "Description of the Rate Limit Gravitee Policy", "enabled" : true } But it doesnt restrict the user after 5 requests per minute.

It responds with the Rate limit error when I add a policy.

brasseld commented 6 years ago

Ok, please provide the export of your API without the rate-limit policy at the API level (only at the plan level).

Also, please give me an example of how you call your API.

sunilb20 commented 6 years ago

Sorry the above one was set in API metadata when a policy was set. But When I create a Plan with Rate Limit in Plan wizard, It doesnt store in DB as well. Neither in API metadata not in Plan metadata. Thats why it does not repopulate also when we edit the plan for viewing. Please find the export : GetCustomer_Plantest-1.zip

sunilb20 commented 6 years ago

I am testing the API using Postman with Authorization header.

brasseld commented 6 years ago

I'm a bit surprised...

Which version of gravitee and which kind of repository (mongodb ?) ?

sunilb20 commented 6 years ago

1.16.3 with jdbc Plugin. Mysql

brasseld commented 6 years ago

Ok, so I think you face this issue with JDBC plugin: https://github.com/gravitee-io/issues/issues/1286

This one has been resolved in 1.18.0

sunilb20 commented 6 years ago

Can I only upgrade jdbc plugin and keep using the same gravitee version : 1.16.3 ?

brasseld commented 6 years ago

Would say yes but I'm not fully confident... best would be to have a try...

https://download.gravitee.io/graviteeio-apim/plugins/repositories/gravitee-repository-jdbc/gravitee-repository-jdbc-1.18.0.zip

sunilb20 commented 6 years ago

Cool Thanks. or else I will have to wait until 1.19 is released.

brasseld commented 6 years ago

Yah, probably your best option if you're not in a hurry.

Looking forward for your feedback (please create an other issue if you still encounter one with 1.19)

brasseld commented 6 years ago

Duplicate of https://github.com/gravitee-io/issues/issues/1406