Skip to content

Chad/#38 authorization#39

Merged
bobheadxi merged 8 commits into
rob/#27-serverside-daemonfrom
chad/#38-authorization
Jan 4, 2018
Merged

Chad/#38 authorization#39
bobheadxi merged 8 commits into
rob/#27-serverside-daemonfrom
chad/#38-authorization

Conversation

@chadlagore

Copy link
Copy Markdown
Contributor

Status: Ready for review

🎟️ Ticket(s): #38


👷 Changes

  • Added an authorization function decorator.
  • Added token generation functionality, passed securely over SSH.
  • Included comments on how to apply it to endpoints.
  • Implemented a trivial endpoint for health checks.
  • Added some testing around auth.

🔦 Testing Instructions

go test ./cmd -cover

@chadlagore chadlagore requested a review from bobheadxi January 4, 2018 03:33
Comment thread cmd/util.go

// getGithubKey returns the key generated by 'inertia remote bootstrap [REMOTE]'
func getGithubKey() (ssh.AuthMethod, error) {
pemFile := "/app/host/.ssh/id_rsa_inertia_deploy"

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.

A bit hesitant about putting this function in util since that path (/app/host/...) applies specifically to the daemon container

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.

Mmmm. How about we make this function more general? getKeyFromPem(pemFile string). Then we could possibly unit test it too.

@chadlagore chadlagore Jan 4, 2018

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.

Actually I think this is the "go" way to write testable code that does file IO. Something like

func getKeyFromPem(pemFile io.Reader)

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.

I can move it back for the time being 👍 Something to think about.

@bobheadxi bobheadxi left a comment

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.

Nice ✨

@bobheadxi bobheadxi merged commit 7203f3e into rob/#27-serverside-daemon Jan 4, 2018
@bobheadxi bobheadxi deleted the chad/#38-authorization branch January 7, 2018 17:33
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