Skip to content

Commit

Permalink
refactor x-access-header
Browse files Browse the repository at this point in the history
  • Loading branch information
labkode committed Jan 14, 2020
1 parent ff09fe4 commit 3132c9d
Show file tree
Hide file tree
Showing 42 changed files with 24 additions and 2,011 deletions.
7 changes: 1 addition & 6 deletions cmd/reva/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ func readConfig() (*config, error) {
}

func writeConfig(c *config) error {
if c.AuthHeader == "" {
c.AuthHeader = "x-access-token"
}

data, err := json.Marshal(c)
if err != nil {
return err
Expand All @@ -89,8 +85,7 @@ func writeConfig(c *config) error {
}

type config struct {
Host string `json:"host"`
AuthHeader string `json:"auth_header"`
Host string `json:"host"`
}

func read(r *bufio.Reader) (string, error) {
Expand Down
11 changes: 0 additions & 11 deletions cmd/reva/gen/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,6 @@ skip_methods = ["/status.php"]
[http.middlewares.auth.token_managers.jwt]
secret = "{{.TokenSecret}}"
[http.middlewares.auth.token_strategies.header]
header = "X-Access-Token"
[http.middlewares.auth.token_writers.header]
header = "X-Access-Token"
# GRPC interceptors
[grpc.interceptors.trace]
Expand All @@ -126,15 +119,11 @@ priority = 300
[grpc.interceptors.auth]
priority = 400
# keys for grpc metadata are always lowercase, so interceptors headers need to use lowercase.
header = "x-access-token"
token_strategy = "header"
token_manager = "jwt"
# GenerateAccessToken contains the credentials in the payload. Skip auth, otherwise services cannot obtain a token.
skip_methods = ["/cs3.authproviderv1beta1.AuthService/GenerateAccessToken"]
[grpc.interceptors.auth.token_strategies.header]
header = "X-Access-Token"
[grpc.interceptors.auth.token_managers.jwt]
secret = "{{.TokenSecret}}"
Expand Down
4 changes: 1 addition & 3 deletions cmd/reva/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ import (
"google.golang.org/grpc/metadata"
)

const defaultHeader = "x-access-token"

func getAuthContext() context.Context {
ctx := context.Background()
// read token from file
Expand All @@ -41,7 +39,7 @@ func getAuthContext() context.Context {
return ctx
}
ctx = token.ContextSetToken(ctx, t)
ctx = metadata.AppendToOutgoingContext(ctx, defaultHeader, t)
ctx = metadata.AppendToOutgoingContext(ctx, token.TokenHeader, t)
return ctx
}

Expand Down
53 changes: 0 additions & 53 deletions docs/old/README.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/old/_config.yml

This file was deleted.

95 changes: 0 additions & 95 deletions docs/old/beginner-guide.md

This file was deleted.

11 changes: 0 additions & 11 deletions docs/old/building-reva.md

This file was deleted.

16 changes: 0 additions & 16 deletions docs/old/command-line.md

This file was deleted.

53 changes: 0 additions & 53 deletions docs/old/config/core.md

This file was deleted.

51 changes: 0 additions & 51 deletions docs/old/config/grpc.md

This file was deleted.

Loading

0 comments on commit 3132c9d

Please sign in to comment.