Skip to content

Commit

Permalink
use auth token in fallback (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
bendecoste authored Aug 22, 2022
1 parent 4a38d89 commit 7196cf5
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions cmd/cape/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,17 @@ func run(cmd *cobra.Command, args []string) error {
input = buf.Bytes()
}

authType := entities.AuthenticationTypeAuth0
t, err := getAuthToken()
if err != nil {
return err
}
auth := entities.FunctionAuth{Type: entities.AuthenticationTypeAuth0, Token: t}
if functionToken != "" {
authType = entities.AuthenticationTypeFunctionToken
auth.Type = entities.AuthenticationTypeFunctionToken
auth.Token = functionToken
}

a := entities.FunctionAuth{
Token: functionToken,
Type: authType,
}
results, err := doRun(u, functionID, input, insecure, funcHash, a, keyPolicyHash, pcrSlice)
results, err := doRun(u, functionID, input, insecure, funcHash, auth, keyPolicyHash, pcrSlice)
if err != nil {
return fmt.Errorf("error processing data: %w", err)
}
Expand Down

0 comments on commit 7196cf5

Please sign in to comment.