Skip to content

Node authenticated endpoint - #5349

Merged
andrey-mysterium merged 5 commits into
masterfrom
node-authenticated-endpoint
Aug 3, 2022
Merged

Node authenticated endpoint#5349
andrey-mysterium merged 5 commits into
masterfrom
node-authenticated-endpoint

Conversation

@andrey-mysterium

Copy link
Copy Markdown
Contributor

No description provided.

@andrey-mysterium andrey-mysterium self-assigned this Aug 1, 2022
Comment thread core/quality/mysterium_morqa.go Outdated
request, err := m.newRequestJSON(http.MethodGet, fmt.Sprintf("providers/statuses?provider_id=%s", providerID), "")
id := identity.Identity{Address: providerID}

request, err := requests.NewSignedGetRequest(m.baseURL, fmt.Sprintf("providers/auth-statuses?provider_id=%s", providerID), m.signer(id))

@tomasmik tomasmik Aug 1, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just something interesting to mention, might be useful for the future: you should now be able to upgrade the API so that you would no longer need to send the provider_id field in URL as you can extract the signer from signature. Obviously you cannot do that now as that would probably break the API.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, you are right. In side effect of auth we can get it inside signature in context

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

yep, let's just use the identity from the signature, it should not be possible to pass anything except it.

Comment thread core/quality/mysterium_morqa.go Outdated
// ProviderStatuses fetch provider connectivity statuses from quality oracle.
func (m *MysteriumMORQA) ProviderStatuses(providerID string) (node.MonitoringAgentStatuses, error) {
request, err := m.newRequestJSON(http.MethodGet, fmt.Sprintf("providers/statuses?provider_id=%s", providerID), "")
id := identity.Identity{Address: providerID}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We got a function for this: identity.FromAddress(providerID)

@tomasmik

tomasmik commented Aug 1, 2022

Copy link
Copy Markdown
Contributor

Also another thing to mention. This PR has 3 commits, 2 of the are useless and 3rd is editing them. Please fix the commits properly before creating a PR. Commits should help to review, they aren't meant to track your development progress. This could have easily been a single commit.

@andrey-mysterium
andrey-mysterium merged commit 88106e0 into master Aug 3, 2022
@andrey-mysterium
andrey-mysterium deleted the node-authenticated-endpoint branch August 3, 2022 08:35
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.

3 participants