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

Spelling #306

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Before sending your pull requests, make sure you followed this list.

## Development Environment

The contribution to this project requires setting up a development
Contribution to this project requires setting up a development
Copy link
Author

Choose a reason for hiding this comment

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

This isn't precisely a spelling thing, it's more of a grammar thing... Anyway, The does the wrong thing here.

environment. The following steps allow developers to test their
setup using local source code.

Expand All @@ -34,7 +34,7 @@ mkdir -p ~/tmpdev
cd ~/tmpdev
```

Second, fork the following repositories in Github into to your own Github
Second, fork the following repositories in GitHub into to your own GitHub
Copy link
Author

Choose a reason for hiding this comment

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

brand

handle, e.g. `anonymous`:

* `https://github.com/greenpau/caddy-security` => `https://github.com/anonymous/caddy-security`
Expand All @@ -57,7 +57,7 @@ make dep

Next, modify `go.mod` in `github.com/greenpau/caddy-security`. Include
`replace` directives to instruct `go` using local directories, as opposed
to follow Github versions.
to follow GitHub versions.

Note: the referenced versions must match.

Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ qtest: covdir
@time richgo test -v -coverprofile=.coverage/coverage.out -run TestParseCaddyfileSingleSignOnProvider ./*.go
@#time richgo test -v -coverprofile=.coverage/coverage.out -run TestParseCaddyfileCredentials ./*.go
@#time richgo test -v -coverprofile=.coverage/coverage.out -run TestParseCaddyfileMessaging ./*.go
@#time richgo test -v -coverprofile=.coverage/coverage.out -run TestParseCaddyfileIdentit* ./*.go
Copy link
Author

Choose a reason for hiding this comment

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

Line 81 above had nearly identical content and there doesn't seem to be anything that would match this that didn't match that.

@#time richgo test -v -coverprofile=.coverage/coverage.out -run TestParseCaddyfileAuthentication ./*.go
@#time richgo test -v -coverprofile=.coverage/coverage.out -run TestParseCaddyfileAuthorization ./*.go
@#go test -v -coverprofile=.coverage/coverage.out -run TestParseCaddyfile ./*.go
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Security App and Plugin for [Caddy v2](https://github.com/caddyserver/caddy). It

Please show your **appreciation for this work** and :star: :star: :star:

Please consider **sponsoring this project** via Github Sponsors!
Please consider **sponsoring this project** via GitHub Sponsors!

Please ask questions either here or via LinkedIn. I am happy to help you! @greenpau

Expand Down
7 changes: 4 additions & 3 deletions caddyfile_authn_ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
package security

import (
"os"
"strings"

"github.com/caddyserver/caddy/v2"
"github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
"github.com/greenpau/caddy-security/pkg/util"
"github.com/greenpau/go-authcrunch/pkg/authn"
"github.com/greenpau/go-authcrunch/pkg/authn/ui"
"io/ioutil"
"strings"
)

func parseCaddyfileAuthPortalUI(h *caddyfile.Dispenser, repl *caddy.Replacer, portal *authn.PortalConfig, rootDirective string) error {
Expand Down Expand Up @@ -131,7 +132,7 @@ func parseCaddyfileAuthPortalUI(h *caddyfile.Dispenser, repl *caddy.Replacer, po
portal.UI.CustomJsPath = strings.ReplaceAll(args, "js ", "")
case strings.HasPrefix(args, "html header path"):
args = strings.ReplaceAll(args, "html header path ", "")
b, err := ioutil.ReadFile(args)
b, err := os.ReadFile(args)
Comment on lines -134 to +135
Copy link
Author

Choose a reason for hiding this comment

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

Go made me do it? ioutil.ReadFile is deprecated and apparently it just uses os.ReadFile

if err != nil {
return h.Errf("%s %s subdirective: %s %v", rootDirective, subDirective, args, err)
}
Expand Down
2 changes: 1 addition & 1 deletion caddyfile_authz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ func TestParseCaddyfileAuthorization(t *testing.T) {
err: fmt.Errorf("security.authorization.policy.with directive has no value, at %s:%d", tf, 4),
},
{
name: "test authorization policy with with unsupported directive",
name: "test authorization policy with unsupported directive",
d: caddyfile.NewTestDispenser(`
security {
authorization policy mypolicy {
Expand Down
4 changes: 2 additions & 2 deletions plugin_authz.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func init() {
}

// AuthzMiddleware authorizes access to endpoints based on
// the presense and content of JWT token.
// the presence and content of JWT token.
type AuthzMiddleware struct {
RouteMatcher string `json:"route_matcher,omitempty" xml:"route_matcher,omitempty" yaml:"route_matcher,omitempty"`
GatekeeperName string `json:"gatekeeper_name,omitempty" xml:"gatekeeper_name,omitempty" yaml:"gatekeeper_name,omitempty"`
Expand Down Expand Up @@ -103,7 +103,7 @@ func (m *AuthzMiddleware) Validate() error {
return nil
}

// Authenticate authorizes access based on the presense and content of
// Authenticate authorizes access based on the presence and content of
// authorization token.
func (m AuthzMiddleware) Authenticate(w http.ResponseWriter, r *http.Request) (caddyauth.User, bool, error) {
ar := requests.NewAuthorizationRequest()
Expand Down