Http.login + Templates

(hinman) #1

I want to accomplish something similar to the post Help with http.login and Google Auth wherein http.login (with Google Auth) and login.jwt are used to protect content under the /project directory, Google oAuth, a specific domain is authorized (, if someone is not in that domain an error is shown they are not using an authorized account and if someone is in that domain they are sent back to the /project directory to view the content.

I’m able to accomplish all items except #4: Showing an error message for those who are not in the approved domain. From the above post it appears the OP was not able to accomplish this either.

Is there any way to use the role functionality in a template? Or any other suggestion for how to accomplish this task?

(Magikstm) #2

You could possibly use this new feature added recently (not available in current version):

It is related to this PR:

You should also be able to use {{.Domain}} in a template.

It really depends on what you exactly want to do.


(hinman) #3

Thanks @magikstm! This might work. I will take a closer look. Does it expose a user’s role from the user_file?

I want to start with limiting access to our domain but might want to add individual email accounts, for a vendor for example. Limiting by role might be the best route.

(Magikstm) #4

Does it expose a user’s role from the user_file?

At the moment it doesn’t.

But, according to the docs:

To match an entry, the user file is searched in linear order and all attributes has to match the data of the authentication backend. The first matching entry will be used and all parameters below the claim attribute are written into the token.