Skip to content

feat: Allow Anonymous #256

New issue

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

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

Already on GitHub? # to your account

Merged
merged 3 commits into from
Oct 15, 2021
Merged

feat: Allow Anonymous #256

merged 3 commits into from
Oct 15, 2021

Conversation

janstadt
Copy link
Contributor

@janstadt janstadt commented Oct 13, 2021

Closes: #255

Proposed Changes

Allow anonymous requests to influx or telegraf.

Checklist

  • CHANGELOG.md updated
  • Rebased/mergeable
  • A test has been added if appropriate
  • dotnet test completes successfully
  • Commit messages are in semantic format
  • Sign CLA (if not already signed)

@janstadt janstadt changed the title Allow Anonymous feature: Allow Anonymous Oct 13, 2021
@janstadt janstadt changed the title feature: Allow Anonymous feat: Allow Anonymous Oct 13, 2021
@codecov-commenter
Copy link

codecov-commenter commented Oct 13, 2021

Codecov Report

Merging #256 (f329a52) into master (1b8eccb) will decrease coverage by 0.47%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #256      +/-   ##
==========================================
- Coverage   85.17%   84.69%   -0.48%     
==========================================
  Files          72       72              
  Lines        6454     6455       +1     
==========================================
- Hits         5497     5467      -30     
- Misses        957      988      +31     
Impacted Files Coverage Δ
Client/InfluxDBClientOptions.cs 95.28% <100.00%> (-1.03%) ⬇️
Client/Internal/ApiClient.cs 55.29% <0.00%> (-34.12%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1b8eccb...f329a52. Read the comment docs.

@bednar bednar mentioned this pull request Oct 14, 2021
Copy link
Contributor

@bednar bednar left a comment

Choose a reason for hiding this comment

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

Thanks for your PR 👍

Please, satisfy default Checklist:

image

and following requirements:

  1. Clarify in CHANGELOG.md that the default authentication schema is Anonymous
  2. Add test to default authentication schema. Something like:
    [Test]
    public void AnonymousSchema() {
        
        var options = new InfluxDBClientOptions.Builder()
            .Url("http://localhost:9999")
            .Build();
        
        Assert.AreEqual(InfluxDBClientOptions.AuthenticationScheme.Anonymous, options.AuthScheme);
    }
    into
    public class InfluxDbClientFactoryTest
  3. Add test to check Authorization header. Something like:
    [Test]
    public async Task Anonymous()
    {
        MockServer
            .Given(Request.Create().UsingGet())
            .RespondWith(CreateResponse("{\"status\":\"active\"}", "application/json"));
    
        _client.Dispose();
        _client = InfluxDBClientFactory.Create(new InfluxDBClientOptions.Builder()
            .Url(MockServerUrl)
            .Build());
        
        await _client.GetAuthorizationsApi().FindAuthorizationByIdAsync("id");
    
        var request = MockServer.LogEntries.Last();
        CollectionAssert.DoesNotContain(request.RequestMessage.Headers.Keys, "Authorization");
    }
    into
    public class InfluxDbClientTest : AbstractMockServerTest

@janstadt
Copy link
Contributor Author

It looks like your CLA link that gets autopopulated in your issue template no longer works. I think it changed to https://www.influxdata.com/legal/cla/. I submitted my info there. Let me know if thats the correct location.

@janstadt janstadt requested a review from bednar October 14, 2021 14:17
@bednar
Copy link
Contributor

bednar commented Oct 15, 2021

It looks like your CLA link that gets autopopulated in your issue template no longer works. I think it changed to https://www.influxdata.com/legal/cla/. I submitted my info there. Let me know if thats the correct location.

Yes, it is correct location.

Copy link
Contributor

@bednar bednar left a comment

Choose a reason for hiding this comment

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

Thanks again for your PR 👍

LGTM 👌

@bednar bednar merged commit 35729ae into influxdata:master Oct 15, 2021
@bednar bednar added this to the 3.1.0 milestone Oct 15, 2021
@bednar bednar added the enhancement New feature or request label Oct 15, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Influx and Telegraf
3 participants