Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request options should be supported instead of oauth, username, password, & proxy constructor parameters #152

Open
llecaroz opened this issue Dec 5, 2018 · 0 comments

Comments

@llecaroz
Copy link

llecaroz commented Dec 5, 2018

Hi,
I am playing with you class & you might not defnitly play with proxy, username, passwords, & others authentication scenarios. Instead of that you should accept a requestOptions parameter in the constructor, allowing the caller to set request options independently/whatever the login scenario to be added (the same for username/password)

For example, by that way, the caller can add extra header request parameters like proxy authentication or whatever.

As example of code from the caller (here the last parameter is the options map you give @ the request method. In that example, I connect to an authenticated proxy & sigin also in jira:

var username = 'username';
var password = 'password';

JiraApi = require('./jira.js').JiraApi;

const HttpProxyAgent = require("http-proxy-agent");
var jira = new JiraApi('https', 'hostname', 443, '2', true, false, null,{
       "agent": new HttpProxyAgent('http://proxyserver'),
        headers: {
            "Proxy-Authorization": 'Bearer myproxycredentialtoken'
            "Authorization": 'Basic ' + Buffer.from(username + ':' + password).toString('base64')
        }
    });
console.log(jira.searchUsers(username, 0, 50, false, false, function(error, string) { console.log(error) }));

Next you will have to concatenate/transfer that map into your own options
This will really make your class more opened, extensible & easier to maintain on that point for you.
Best regards
Louis

@llecaroz llecaroz changed the title You should not support request options in the JiraApi class request options should be supported instead of oauth, username, password, & proxy Dec 5, 2018
@llecaroz llecaroz changed the title request options should be supported instead of oauth, username, password, & proxy request options should be supported instead of oauth, username, password, & proxy constructor parameters ! Dec 5, 2018
@llecaroz llecaroz changed the title request options should be supported instead of oauth, username, password, & proxy constructor parameters ! request options should be supported instead of oauth, username, password, & proxy constructor parameters Dec 5, 2018
llecaroz pushed a commit to llecaroz/node-jira that referenced this issue Dec 6, 2018
llecaroz pushed a commit to llecaroz/node-jira that referenced this issue Dec 6, 2018
Be able to set request options @ the JiraApi level, will make more flexible that package allowing it to sign in on all infra types: authenticated proxy, jira, oauth or whatever

steves#152
llecaroz pushed a commit to llecaroz/node-jira that referenced this issue Dec 6, 2018
Be able to set request options @ the JiraApi level, will make more flexible that package allowing it to sign in on all infra types: authenticated proxy, jira, oauth or whatever

steves#152
llecaroz pushed a commit to llecaroz/node-jira that referenced this issue Dec 6, 2018
Be able to set request options @ the JiraApi level, will make more flexible that package allowing it to sign in on all infra types: authenticated proxy, jira, oauth or whatever

steves#152
llecaroz pushed a commit to llecaroz/node-jira that referenced this issue Dec 6, 2018
Be able to set request options @ the JiraApi level, will make more flexible that package allowing it to sign in on all infra types: authenticated proxy, jira, oauth or whatever

steves#152
llecaroz pushed a commit to llecaroz/node-jira that referenced this issue Dec 6, 2018
Be able to set request options @ the JiraApi level, will make more flexible that package allowing it to sign in on all infra types: authenticated proxy, jira, oauth or whatever

steves#152
llecaroz pushed a commit to llecaroz/node-jira that referenced this issue Dec 6, 2018
Be able to set request options @ the JiraApi level, will make more flexible that package allowing it to sign in on all infra types: authenticated proxy, jira, oauth or whatever

steves#152
llecaroz pushed a commit to llecaroz/node-jira that referenced this issue Dec 6, 2018
Be able to set request options @ the JiraApi level, will make more flexible that package allowing it to sign in on all infra types: authenticated proxy, jira, oauth or whatever

steves#152
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant