Skip to content

Commit

Permalink
added oauth authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
DDH13 committed Mar 20, 2024
1 parent ae534f3 commit 1476954
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 @@ -1111,7 +1111,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 1476954

Please sign in to comment.