Skip to content

Commit

Permalink
auth_command: change to a bool response and setting from apply.
Browse files Browse the repository at this point in the history
The function applies as I would expect but I believe it could be refactored to be cleaner.  Additional questions...can be proto & raft requests be cleaned up.
  • Loading branch information
tarcinil committed Jan 19, 2020
1 parent a52762e commit 2ce580e
Show file tree
Hide file tree
Showing 6 changed files with 296 additions and 315 deletions.
2 changes: 1 addition & 1 deletion Documentation/dev-guide/api_reference_v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ Empty field.

| Field | Description | Type |
| ----- | ----------- | ---- |
| header | | ResponseHeader |
| status | | bool |



Expand Down
5 changes: 3 additions & 2 deletions Documentation/dev-guide/apispec/swagger/rpc.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1479,8 +1479,9 @@
"etcdserverpbAuthStatusResponse": {
"type": "object",
"properties": {
"header": {
"$ref": "#/definitions/etcdserverpbResponseHeader"
"status": {
"type": "boolean",
"format": "boolean"
}
}
},
Expand Down
8 changes: 1 addition & 7 deletions auth/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,13 +286,7 @@ func (as *authStore) AuthDisable() {
}

func (as *authStore) AuthStatus() bool {
as.enabledMu.Lock()
defer as.enabledMu.Unlock()
if as.IsAuthEnabled() {
return true
}

return false
return as.IsAuthEnabled()
}

func (as *authStore) Close() error {
Expand Down
4 changes: 2 additions & 2 deletions etcdserver/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -743,8 +743,8 @@ func (a *applierV3backend) AuthDisable() (*pb.AuthDisableResponse, error) {
}

func (a *applierV3backend) AuthStatus() (*pb.AuthStatusResponse, error) {
a.s.AuthStore().AuthStatus()
return &pb.AuthStatusResponse{Header: newHeader(a.s)}, nil
status := a.s.AuthStore().AuthStatus()
return &pb.AuthStatusResponse{status}, nil
}

func (a *applierV3backend) Authenticate(r *pb.InternalAuthenticateRequest) (*pb.AuthenticateResponse, error) {
Expand Down
Loading

0 comments on commit 2ce580e

Please sign in to comment.