{"action":"created","issue":{"url":"https://api.github.com/repos/jhipster/generator-jhipster/issues/3336","repository_url":"https://api.github.com/repos/jhipster/generator-jhipster","labels_url":"https://api.github.com/repos/jhipster/generator-jhipster/issues/3336/labels{/name}","comments_url":"https://api.github.com/repos/jhipster/generator-jhipster/issues/3336/comments","events_url":"https://api.github.com/repos/jhipster/generator-jhipster/issues/3336/events","html_url":"https://github.com/jhipster/generator-jhipster/issues/3336","id":145816352,"number":3336,"title":"Gateway should not proxy to microservice when token is missing","user":{"login":"gmarziou","id":361007,"avatar_url":"https://avatars.githubusercontent.com/u/361007?v=3","gravatar_id":"","url":"https://api.github.com/users/gmarziou","html_url":"https://github.com/gmarziou","followers_url":"https://api.github.com/users/gmarziou/followers","following_url":"https://api.github.com/users/gmarziou/following{/other_user}","gists_url":"https://api.github.com/users/gmarziou/gists{/gist_id}","starred_url":"https://api.github.com/users/gmarziou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gmarziou/subscriptions","organizations_url":"https://api.github.com/users/gmarziou/orgs","repos_url":"https://api.github.com/users/gmarziou/repos","events_url":"https://api.github.com/users/gmarziou/events{/privacy}","received_events_url":"https://api.github.com/users/gmarziou/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jhipster/generator-jhipster/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":{"login":"gmarziou","id":361007,"avatar_url":"https://avatars.githubusercontent.com/u/361007?v=3","gravatar_id":"","url":"https://api.github.com/users/gmarziou","html_url":"https://github.com/gmarziou","followers_url":"https://api.github.com/users/gmarziou/followers","following_url":"https://api.github.com/users/gmarziou/following{/other_user}","gists_url":"https://api.github.com/users/gmarziou/gists{/gist_id}","starred_url":"https://api.github.com/users/gmarziou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gmarziou/subscriptions","organizations_url":"https://api.github.com/users/gmarziou/orgs","repos_url":"https://api.github.com/users/gmarziou/repos","events_url":"https://api.github.com/users/gmarziou/events{/privacy}","received_events_url":"https://api.github.com/users/gmarziou/received_events","type":"User","site_admin":false},"milestone":null,"comments":4,"created_at":"2016-04-04T21:57:39Z","updated_at":"2016-04-04T22:58:44Z","closed_at":null,"body":"##### **Overview of the issue**\r\n\r\nWhen calling a microservice resource through gateway without a JWT token, the request is passed to microservice app that rejects it.\r\nThe request should be rejected by gateway.\r\n\r\n##### **Motivation for or Use Case** \r\n\r\nThe purpose of the gateway is to protect the backend services from being accessed by unauthorized users even though the issue is minor because it's correctly handled by service.\r\n\r\n##### **JHipster Version(s)** \r\n\r\n3.0 current master\r\n\r\n##### **JHipster configuration, a `.yo-rc.json` file generated in the root folder** \r\n\r\n~~~json\r\n{\r\n  \"generator-jhipster\": {\r\n    \"jhipsterVersion\": \"3.0.0\",\r\n    \"baseName\": \"srv1\",\r\n    \"packageName\": \"com.mycompany.myapp\",\r\n    \"packageFolder\": \"com/mycompany/myapp\",\r\n    \"serverPort\": \"8081\",\r\n    \"authenticationType\": \"jwt\",\r\n    \"hibernateCache\": \"ehcache\",\r\n    \"databaseType\": \"sql\",\r\n    \"devDatabaseType\": \"h2Memory\",\r\n    \"prodDatabaseType\": \"postgresql\",\r\n    \"searchEngine\": \"no\",\r\n    \"buildTool\": \"gradle\",\r\n    \"jwtSecretKey\": \"9e8cd328e801969f97707b842cfd468993aac613\",\r\n    \"enableTranslation\": true,\r\n    \"applicationType\": \"microservice\",\r\n    \"testFrameworks\": [],\r\n    \"skipClient\": true,\r\n    \"skipUserManagement\": true,\r\n    \"nativeLanguage\": \"en\",\r\n    \"languages\": [\r\n      \"en\"\r\n    ],\r\n    \"clusteredHttpSession\": \"no\",\r\n    \"websocket\": \"no\",\r\n    \"enableSocialSignIn\": false,\r\n    \"jhiPrefix\": \"jhi\"\r\n  }\r\n}\r\n~~~\r\n\r\n##### **Reproduce the error** \r\n\r\n~~~\r\ncurl -X GET --header 'Accept: application/json' 'http://127.0.0.1:8080/srv1/api/books'\r\n~~~\r\n\r\n##### **Suggest a Fix** \r\n\r\nAdd folowling lines to `SecurityConfiguration` for gateway only:\r\n\r\n~~~java\r\n            .antMatchers(\"/swagger-resources\").permitAll()\r\n            .antMatchers(\"/\").permitAll()\r\n            .anyRequest().authenticated()\r\n~~~\r\n\r\nIt could have been simpler with a prefix for proxified service URLs."},"comment":{"url":"https://api.github.com/repos/jhipster/generator-jhipster/issues/comments/205533613","html_url":"https://github.com/jhipster/generator-jhipster/issues/3336#issuecomment-205533613","issue_url":"https://api.github.com/repos/jhipster/generator-jhipster/issues/3336","id":205533613,"user":{"login":"gmarziou","id":361007,"avatar_url":"https://avatars.githubusercontent.com/u/361007?v=3","gravatar_id":"","url":"https://api.github.com/users/gmarziou","html_url":"https://github.com/gmarziou","followers_url":"https://api.github.com/users/gmarziou/followers","following_url":"https://api.github.com/users/gmarziou/following{/other_user}","gists_url":"https://api.github.com/users/gmarziou/gists{/gist_id}","starred_url":"https://api.github.com/users/gmarziou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gmarziou/subscriptions","organizations_url":"https://api.github.com/users/gmarziou/orgs","repos_url":"https://api.github.com/users/gmarziou/repos","events_url":"https://api.github.com/users/gmarziou/events{/privacy}","received_events_url":"https://api.github.com/users/gmarziou/received_events","type":"User","site_admin":false},"created_at":"2016-04-04T22:58:44Z","updated_at":"2016-04-04T22:58:44Z","body":"But we want the gateways to be stateless."}}