Skip to content

Commit

Permalink
fixed auth
Browse files Browse the repository at this point in the history
  • Loading branch information
DDH13 committed Apr 15, 2024
1 parent 0170a21 commit 67fc8e3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions adapter/internal/oasparser/model/adapter_internal_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,21 @@ func (adapterInternalAPI *AdapterInternalAPI) SetInfoGRPCRouteCR(grpcRoute *gwap
if authScheme.Spec.Override != nil && authScheme.Spec.Override.Disabled != nil {
adapterInternalAPI.disableAuthentications = *authScheme.Spec.Override.Disabled
}
authSpec := utils.SelectPolicy(&authScheme.Spec.Override, &authScheme.Spec.Default, nil, nil)
if authSpec != nil && authSpec.AuthTypes != nil && authSpec.AuthTypes.Oauth2.Required != "" {
adapterInternalAPI.SetXWSO2ApplicationSecurity(authSpec.AuthTypes.Oauth2.Required == "mandatory")
} else {
adapterInternalAPI.SetXWSO2ApplicationSecurity(true)
}
adapterInternalAPI.disableScopes = disableScopes
// Check whether the API has a backend JWT token
if apiPolicy != nil && apiPolicy.Spec.Override != nil && apiPolicy.Spec.Override.BackendJWTPolicy != nil {
backendJWTPolicy := resourceParams.BackendJWTMapping[types.NamespacedName{
Name: apiPolicy.Spec.Override.BackendJWTPolicy.Name,
Namespace: grpcRoute.Namespace,
}.String()].Spec
adapterInternalAPI.backendJWTTokenInfo = parseBackendJWTTokenToInternal(backendJWTPolicy)
}
return nil
}

Expand Down

0 comments on commit 67fc8e3

Please sign in to comment.