{"action":"opened","issue":{"url":"https://api.github.com/repos/strongloop/loopback-connector-rest/issues/122","repository_url":"https://api.github.com/repos/strongloop/loopback-connector-rest","labels_url":"https://api.github.com/repos/strongloop/loopback-connector-rest/issues/122/labels{/name}","comments_url":"https://api.github.com/repos/strongloop/loopback-connector-rest/issues/122/comments","events_url":"https://api.github.com/repos/strongloop/loopback-connector-rest/issues/122/events","html_url":"https://github.com/strongloop/loopback-connector-rest/issues/122","id":334651021,"node_id":"MDU6SXNzdWUzMzQ2NTEwMjE=","number":122,"title":"Unable to set authentication options at datasource level","user":{"login":"ivandov","id":7094613,"node_id":"MDQ6VXNlcjcwOTQ2MTM=","avatar_url":"https://avatars2.githubusercontent.com/u/7094613?v=4","gravatar_id":"","url":"https://api.github.com/users/ivandov","html_url":"https://github.com/ivandov","followers_url":"https://api.github.com/users/ivandov/followers","following_url":"https://api.github.com/users/ivandov/following{/other_user}","gists_url":"https://api.github.com/users/ivandov/gists{/gist_id}","starred_url":"https://api.github.com/users/ivandov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ivandov/subscriptions","organizations_url":"https://api.github.com/users/ivandov/orgs","repos_url":"https://api.github.com/users/ivandov/repos","events_url":"https://api.github.com/users/ivandov/events{/privacy}","received_events_url":"https://api.github.com/users/ivandov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-21T20:45:40Z","updated_at":"2018-06-21T20:45:40Z","closed_at":null,"author_association":"NONE","body":"# Description\r\nWhen using the loopback-rest-connector, you are not able to set the `options.auth` values at the datasource level. They must instead be set at the operation level, which leads to a lot of duplicated `auth` blocks.\r\n\r\n```\r\n{\r\n  \"zosmf\": {\r\n    \"name\": \"zosmf\",\r\n    \"connector\": \"rest\",\r\n    \"debug\": true,\r\n    \"crud\": false,\r\n    \"options\": {\r\n      \"headers\": {\r\n        \"accept\": \"application/json\",\r\n        \"content-type\": \"application/json\",\r\n        \"X-CSRF-ZOSMF-HEADER\": \"\",\r\n        \"auth\": {\r\n          \"user\": \"${ZOSMF_USER} -- DOES NOT WORK\",\r\n          \"pass\": \"${ZOSMF_PASS} -- DOES NOT WORK\"\r\n        }\r\n      },\r\n      \"strictSSL\": false,\r\n      \"baseUrl\": \"${ZOSMF_API_URL}\"\r\n    },\r\n    \"operations\": [{\r\n      \"template\": {\r\n        \"method\": \"GET\",\r\n        \"url\": \"/scr/{objectId}\",\r\n        \"options\": {\r\n          \"auth\": {\r\n            \"user\": \"${ZOSMF_USER}\",\r\n            \"pass\": \"${ZOSMF_PASS}\"\r\n          }\r\n        }\r\n      },\r\n      \"functions\": {\r\n        \"getScrEntry\": [\r\n          \"objectId\"\r\n        ]\r\n      }\r\n    }]\r\n  }\r\n}\r\n```\r\n\r\n<!--\r\nIf feature: A description of the feature\r\nIf bug: Steps to reproduce\r\n-->\r\n\r\n# Link to reproduction sandbox\r\nWill need to setup sandbox if needed, please let me know.\r\n\r\n# Expected result\r\nDatasource level authentication is enforced at the operation level when not manually specified in every operation.\r\n\r\n\r\n# Additional information\r\ndarwin x64 9.8.0\r\n├── loopback@3.19.3\r\n├── loopback-boot@2.27.1\r\n├── loopback-component-explorer@6.0.1\r\n├── loopback-connector-rest@3.1.1\r\n"}}
{"actor":{"display_login":"ivandov"}}