Skip to content

Commit

Permalink
Merge pull request #680 from nats-io/fanout
Browse files Browse the repository at this point in the history
Outbound data architecture changes
  • Loading branch information
derekcollison authored Jun 12, 2018
2 parents e597043 + f7cb616 commit 5598d5c
Show file tree
Hide file tree
Showing 26 changed files with 2,100 additions and 708 deletions.
11 changes: 5 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
language: go
go:
- 1.8.x
- 1.9.x
- 1.10.x
- 1.9.6
- 1.10.2
install:
- go get github.com/nats-io/go-nats
- go get github.com/mattn/goveralls
Expand All @@ -16,9 +15,9 @@ before_script:
- go vet $EXCLUDE_VENDOR
- misspell -error -locale US .
- megacheck $EXCLUDE_VENDOR
- if [[ "$TRAVIS_GO_VERSION" == 1.9.* ]]; then ./scripts/cross_compile.sh $TRAVIS_TAG; fi
- if [[ "$TRAVIS_GO_VERSION" == 1.10.* ]]; then ./scripts/cross_compile.sh $TRAVIS_TAG; fi
script:
- go test -i -race $EXCLUDE_VENDOR
- if [[ "$TRAVIS_GO_VERSION" == 1.9.* ]]; then ./scripts/cov.sh TRAVIS; else go test -v -race $EXCLUDE_VENDOR; fi
- if [[ "$TRAVIS_GO_VERSION" == 1.10.* ]]; then ./scripts/cov.sh TRAVIS; else go test -v -race $EXCLUDE_VENDOR; fi
after_success:
- if [[ "$TRAVIS_GO_VERSION" == 1.9.* ]] && [ "$TRAVIS_TAG" != "" ]; then ghr --owner nats-io --token $GITHUB_TOKEN --draft --replace $TRAVIS_TAG pkg/; fi
- if [[ "$TRAVIS_GO_VERSION" == 1.10.* ]] && [ "$TRAVIS_TAG" != "" ]; then ghr --owner nats-io --token $GITHUB_TOKEN --draft --replace $TRAVIS_TAG pkg/; fi
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ A High Performance [NATS](https://nats.io) Server written in [Go](http://golang.

## Quickstart

If you just want to start using NATS, and you have [installed Go](https://golang.org/doc/install) 1.5+ and set your $GOPATH:
If you just want to start using NATS, and you have [installed Go](https://golang.org/doc/install) 1.9+ and set your $GOPATH:

Install and run the NATS server:

Expand Down
17 changes: 14 additions & 3 deletions server/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,28 @@ func (s *Server) checkAuthorization(c *client) bool {
}
}

// hasUsers leyt's us know if we have a users array.
func (s *Server) hasUsers() bool {
s.mu.Lock()
hu := s.users != nil
s.mu.Unlock()
return hu
}

// isClientAuthorized will check the client against the proper authorization method and data.
// This could be token or username/password based.
func (s *Server) isClientAuthorized(c *client) bool {
// Snapshot server options.
opts := s.getOpts()

// Check custom auth first, then multiple users, then token, then single user/pass.
if s.opts.CustomClientAuthentication != nil {
return s.opts.CustomClientAuthentication.Check(c)
} else if s.users != nil {
if opts.CustomClientAuthentication != nil {
return opts.CustomClientAuthentication.Check(c)
} else if s.hasUsers() {
s.mu.Lock()
user, ok := s.users[c.opts.Username]
s.mu.Unlock()

if !ok {
return false
}
Expand Down
Loading

0 comments on commit 5598d5c

Please sign in to comment.