Skip to content

Commit

Permalink
add method back
Browse files Browse the repository at this point in the history
  • Loading branch information
jonachang committed Nov 16, 2023
1 parent 1c0ab56 commit 6b3ff85
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
3 changes: 2 additions & 1 deletion pkg/poc/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ func (f *frontend) getRouter() chi.Router {
// TODO(jonachang): remove this when go production.
if f.enableMISE == true {
miseToken := extractAuthBearerToken(r.Header)
miseError := authenticateWithMISE(r.Context(), miseToken)
method := r.Method
miseError := authenticateWithMISE(r.Context(), method, miseToken)
if miseError != nil {
f.logger.Infof("MISE error: %s", miseError)
w.Write([]byte("****** Blocked by MISE authorization ******"))
Expand Down
9 changes: 5 additions & 4 deletions pkg/poc/miseAuthentication.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ const (
originURI = "https://server/endpoint"
)

func authenticateWithMISE(ctx context.Context, token string) error {
func authenticateWithMISE(ctx context.Context, requestMethod string, token string) error {

requestData := MiseRequestData{
MiseURL: miseURL,
OriginalURI: originURI,
Token: token,
MiseURL: miseURL,
OriginalURI: originURI,
OriginalMethod: requestMethod,
Token: token,
}

req, err := createMiseHTTPRequest(ctx, requestData)
Expand Down
12 changes: 6 additions & 6 deletions poc/pkg/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,18 @@ MISE:
TenantId: 72f988bf-86f1-41af-91ab-2d7cd011db47
Audience: https://management.azure.com
# Possible log levels: Trace, Debug, Information, Warning, Error, Critical, None
LogLevel: Information
LogLevel: Debug
InboundPolicies:
Label: aro-rp-arm-policy
AuthenticationSchemes: Bearer
TokenTypes: AppToken
Authority: https://sts.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47/
Authority: https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/v2.0
ValidApplicationIds: ""
Internal:
Label: aro-rp-internal-policy
AuthenticationSchemes: Bearer
TokenTypes: AppToken
Authority: https://sts.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47/
Authority: https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/v2.0
ValidApplicationIds: ""
AllowedHosts: "*"
Kestrel:
Expand All @@ -141,6 +141,6 @@ MISE:
name: miseconfig
Logging:
LogLevel:
Default: Information
Microsoft: Information
Microsoft_Hosting_Lifetime: Information
Default: Debug
Microsoft: Debug
Microsoft_Hosting_Lifetime: Debug

0 comments on commit 6b3ff85

Please sign in to comment.