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

Some improvements #151

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Dragomir-Ivanov
Copy link

No description provided.

@coveralls
Copy link

coveralls commented Nov 24, 2019

Coverage Status

Coverage increased (+0.03%) to 91.769% when pulling 9c29985 on Dragomir-Ivanov:master into be2ae2c on tarent:master.

@@ -20,7 +20,8 @@ const contentTypeJWT = "application/jwt"
const contentTypeJSON = "application/json"
const contentTypePlain = "text/plain"

type userClaimsFunc func(userInfo model.UserInfo) (jwt.Claims, error)
Copy link
Contributor

Choose a reason for hiding this comment

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

This type should not be exported. It makes no sense to export this from my point of view; it is an implementation detail of loginsrv and not a public API which should be used from outside. If you want to provide custom user claims use the "user endpoint"-feature

Copy link
Author

Choose a reason for hiding this comment

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

I am using loginsrv embedded in my application, and my custom provider is just another piece of code in that application. It doesn't make sense to do provision over HTTP in this case(opening localhost server, and then connecting to itself). Maybe if we export UserClaimsFunc "user endpoint" feature becomes one of the user claims providers available.
I do find mandatory provision over HTTP as unnecessary.

@@ -485,6 +485,45 @@ func TestHandler_ReturnUserInfoJSON(t *testing.T) {
Equal(t, input, output)
}

func callWithHandler(h *Handler, req *http.Request) *httptest.ResponseRecorder {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please move this to the end of the file.

@g-w
Copy link
Contributor

g-w commented Dec 5, 2019

Hello @Dragomir-Ivanov ,
I'll accept your changes if you resolve the issues pointed out in my review. Please, remove 9c29985 from the PR and reformat the test.

Thanks, Gregor

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.

None yet

3 participants