Skip to content

Feat/auth methods #15

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

Merged
merged 8 commits into from
Aug 29, 2019
Merged

Feat/auth methods #15

merged 8 commits into from
Aug 29, 2019

Conversation

mamoonraja
Copy link
Member

@mamoonraja mamoonraja commented Aug 26, 2019

This pull request updates authentication to use Authenticators rather than AuthConfigs. Additionally, legacy authentication logic was removed. Changes to the core essentially followed changes to the dotnet sdk core and I have tried to make a bunch of new changes to Connectors to make sure we match dotnet as closely as possile. I have tested changes with IAM for RestConnector, will do some more testing on other authenticators, and for WSConnector.

We are using branch 1.0.0-rc to stage major release changes. Below is the new snippet for authentication:

IamAuthenticator authenticator = new IamAuthenticator("{apikey}");
AssistantService service = new AssistantService("{versionDate}", authenticator);

Following changes to respective service files will be made:

Constructors:

public AssistantService(string versionDate) : this(versionDate, ConfigBasedAuthenticatorFactory.GetAuthenticator(serviceId)) { }

public AssistantService(string versionDate, Authenticator authenticator) : base(versionDate, authenticator, serviceId)

In methods:

 RESTConnector connector = RESTConnector.GetConnector(authenticator, "/v1/workspaces");
 if (connector == null)
{
     return false;
}

 authenticator.Authenticate(connector);
return connector.Send(req);

@mamoonraja mamoonraja requested a review from mediumTaj August 26, 2019 02:53
Copy link
Member

@mediumTaj mediumTaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is coming together! A few questions here. We prob can get rid of some constructors in the base service. What do you think about moving adding headers to the connectors in the form of WithAuthentication methods?

do not authenticate in WS connector as we are setting auth headers in Authenticate()
Copy link
Member

@mediumTaj mediumTaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 looks good - just a few minor changes. Approving now though.

@mamoonraja mamoonraja changed the base branch from 1.0.0-rc to 1.0.0-rc1 August 27, 2019 19:47
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

Successfully merging this pull request may close these issues.

2 participants