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

Filter requests using regex on base64 decoded userId:passwd #475

Merged
merged 2 commits into from
Aug 22, 2017
Merged

Filter requests using regex on base64 decoded userId:passwd #475

merged 2 commits into from
Aug 22, 2017

Conversation

AshwinJay
Copy link
Contributor

Hello, we have a need to filter using the HTTP Basic Auth header. Specifically, using a regex to match the "UserId" portion of the header.

So, I made a small change to extract the basic auth header, base64 decode the userid:passwd portion of the string and then run it against the given regex.

Usage snippet: --http-basic-auth-filter "^customer[0-9].*"

Thanks.

…auth

Example snippet: --http-basic-auth-filter "^customer[0-9].*"
return fmt.Sprint(*h)
}

func (h *HTTPHeaderBasicAuthFilters) Set(value string) error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

exported method HTTPHeaderBasicAuthFilters.Set should have comment or be unexported

regexp *regexp.Regexp
}

// HTTPHeaderFilters holds list of headers and their regexps
Copy link
Collaborator

Choose a reason for hiding this comment

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

comment on exported type HTTPHeaderBasicAuthFilters should be of the form "HTTPHeaderBasicAuthFilters ..." (with optional leading article)

@buger buger merged commit 9cf1ad6 into buger:master Aug 22, 2017
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.

3 participants