Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Add AuthMethod based on HTTP Authorization header #504

Merged
merged 2 commits into from
Jul 27, 2017
Merged

Conversation

strin
Copy link

@strin strin commented Jul 24, 2017

This allows us to use Authorization: Bearer XXXXX to authenticate Git HTTP requests.

@codecov
Copy link

codecov bot commented Jul 25, 2017

Codecov Report

Merging #504 into v4 will decrease coverage by 0.7%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##               v4     #504      +/-   ##
==========================================
- Coverage   78.12%   77.42%   -0.71%     
==========================================
  Files         127      127              
  Lines        9313     9323      +10     
==========================================
- Hits         7276     7218      -58     
- Misses       1241     1324      +83     
+ Partials      796      781      -15
Impacted Files Coverage Δ
plumbing/transport/http/common.go 78.84% <0%> (-8.39%) ⬇️
plumbing/transport/ssh/common.go 2.81% <0%> (-45.08%) ⬇️
plumbing/transport/ssh/auth_method.go 33.33% <0%> (-24.77%) ⬇️

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 d3c7400...c8cc3d5. Read the comment docs.

@mcuadros
Copy link
Contributor

@strin looks like your PRs are being mixed because you are using the same branch, can you take care of this?

return
}

r.Header.Set("Authorization", a.token)
Copy link
Contributor

Choose a reason for hiding this comment

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

To be Bearer requires the format: " Authorization: Bearer %s"

}

// NewTokenAuth returns a tokenAuth on the given authrorization token.
func NewTokenAuth(token string) *TokenAuth {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can be called it NewBearerAuth ?

}

func (a *TokenAuth) String() string {
return fmt.Sprintf("%s...", a.token[:10])
Copy link
Contributor

Choose a reason for hiding this comment

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

The token should be cloaked, otherwise the security can be compromised.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants