Skip to content
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

Added public routes for /jwks and /configuration #198

Merged
merged 1 commit into from Apr 9, 2022

Conversation

Probotect0r
Copy link
Contributor

@Probotect0r Probotect0r commented Apr 7, 2022

Closes #197

I haven't been able to get the dev environment working, so haven't been able to test this. Although, the changes are simple copy and paste.

Here's what I am running into (not a Go developer so please advise on anything obvious):

go install
# github.com/mattn/go-sqlite3
sqlite3-binding.c: In function ‘sqlite3SelectNew’:
sqlite3-binding.c:117843:10: warning: function may return address of local variable [-Wreturn-local-addr]
117843 |   return pNew;
       |          ^~~~
sqlite3-binding.c:117802:10: note: declared here
117802 |   Select standin;
       |          ^~~~~~~
ego server/views
make: ego: No such file or directory
make: *** [Makefile:14: init] Error 127

Seems like I also need ego installed, but I have run go get github.com/go-ego/ego without success.

Also, the main readme mentions make docker, but that target doesn't exist in the Makefile.

@cainlevy
Copy link
Member

cainlevy commented Apr 8, 2022

@Probotect0r thanks for the feedback. looks like the "contributing" docs are indeed out of date. for this, i believe make test and make server are all that you will need.

I have run go get github.com/go-ego/ego without success.

Took me a moment to uncover the problem but this appears to be a different "ego" library. AuthN relies on go get github.com/benbjohnson/ego instead. That used to be part of the go.mod list until a recent PR.

Sorry for the rough start! Let me know if this is helpful.

@Probotect0r
Copy link
Contributor Author

That's helpful, thanks. I was able to get make server working. I have confirmed that the jwks and /configuration routes are now available on both the public and private API. However, make test is failing due to this failed test:

--- FAIL: TestAccountStore (0.00s)
    account_store_test.go:40:
                Error Trace:    account_store_test.go:40
                Error:          Received unexpected error:
                                dial tcp 127.0.0.1:8703: connect: connection refused
                                NewDB
                                github.com/keratin/authn-server/app/data/postgres_test.newTestDB
                                        /home/sagar/Code/authn-server/app/data/postgres/account_store_test.go:29
                                github.com/keratin/authn-server/app/data/postgres_test.TestAccountStore
                                        /home/sagar/Code/authn-server/app/data/postgres/account_store_test.go:39
                                testing.tRunner
                                        /home/sagar/.asdf/installs/golang/1.17.2/go/src/testing/testing.go:1259
                                runtime.goexit
                                        /home/sagar/.asdf/installs/golang/1.17.2/go/src/runtime/asm_amd64.s:1581
                Test:           TestAccountStore
FAIL
FAIL    github.com/keratin/authn-server/app/data/postgres       0.006s
ok      github.com/keratin/authn-server/app/data/private        (cached)

I don't believe this is related to my code changes. Any ideas?

@Probotect0r
Copy link
Contributor Author

Probotect0r commented Apr 8, 2022

Ah, figured it out. My Postgres container was not starting up via docker-compose due to not specifying DB_PASSWORD and DB_USERNAME in the .env. All tests are passing now. A sample .env should be included in the repo to make it easy to start up the dev environment.

@cainlevy
Copy link
Member

cainlevy commented Apr 9, 2022

Looks good! Congrats, you're a go developer now. 😄

@cainlevy cainlevy closed this Apr 9, 2022
@cainlevy cainlevy reopened this Apr 9, 2022
@cainlevy cainlevy merged commit e58b7c8 into keratin:main Apr 9, 2022
@cainlevy
Copy link
Member

cainlevy commented Apr 9, 2022

jeffreylo added a commit to jeffreylo/authn-server that referenced this pull request Apr 9, 2022
Reported at
keratin#198 (comment):

> Took me a moment to uncover the problem but this appears to be a
> different "ego" library. AuthN relies on go get
> github.com/benbjohnson/ego instead. That used to be part of the
> go.mod list until a recent PR.

Add a tools.go to record the tooling dependency per guidance:
https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module. This
ensures ego sticks around when authn-server's dependencies are
modified.
@Probotect0r Probotect0r deleted the public-jwks-route branch April 11, 2022 15:31
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.

/jwks endpoint is not public
2 participants