Skip to content

Commit

Permalink
refactor tokenissuer
Browse files Browse the repository at this point in the history
  • Loading branch information
tharindu1st committed Jan 9, 2024
1 parent 92cafae commit d9f76dc
Show file tree
Hide file tree
Showing 61 changed files with 3,824 additions and 3,191 deletions.
18 changes: 0 additions & 18 deletions adapter/api/proto/wso2/discovery/service/apkmgt/eventds.proto

This file was deleted.

35 changes: 0 additions & 35 deletions adapter/api/proto/wso2/discovery/subscription/application.proto

This file was deleted.

This file was deleted.

This file was deleted.

42 changes: 0 additions & 42 deletions adapter/api/proto/wso2/discovery/subscription/event.proto

This file was deleted.

33 changes: 0 additions & 33 deletions adapter/api/proto/wso2/discovery/subscription/jwtIssuer_list.proto

This file was deleted.

39 changes: 0 additions & 39 deletions adapter/api/proto/wso2/discovery/subscription/subscription.proto

This file was deleted.

18 changes: 0 additions & 18 deletions adapter/api/proto/wso2/discovery/subscription/url_mapping.proto

This file was deleted.

1 change: 0 additions & 1 deletion adapter/api/protogen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ printf " - ${GREEN}${BOLD}done${NC}\n"
printf "protoc go messages"
docker run -v `pwd`:/defs namely/protoc-all:$PROTOC_VERSION -l go --go-source-relative -i proto -i target/include/ -o target/gen/go -d proto/wso2/discovery/api/
docker run -v `pwd`:/defs namely/protoc-all:$PROTOC_VERSION -l go --go-source-relative -i proto -i target/include/ -o target/gen/go -d proto/wso2/discovery/config/enforcer/
docker run -v `pwd`:/defs namely/protoc-all:$PROTOC_VERSION -l go --go-source-relative -i proto -i target/include/ -o target/gen/go -d proto/wso2/discovery/subscription/
printf " - ${GREEN}${BOLD}done${NC}\n"

# map of proto imports for which we need to update the genrated import path
Expand Down
21 changes: 0 additions & 21 deletions adapter/internal/discovery/xds/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ import (
"github.com/wso2/apk/adapter/internal/oasparser/envoyconf"
"github.com/wso2/apk/adapter/internal/oasparser/model"
operatorconsts "github.com/wso2/apk/adapter/internal/operator/constants"
"github.com/wso2/apk/adapter/pkg/discovery/api/wso2/discovery/subscription"
wso2_cache "github.com/wso2/apk/adapter/pkg/discovery/protocol/cache/v3"
wso2_resource "github.com/wso2/apk/adapter/pkg/discovery/protocol/resource/v3"
eventhubTypes "github.com/wso2/apk/adapter/pkg/eventhub/types"
Expand Down Expand Up @@ -566,26 +565,6 @@ func UpdateEnforcerApis(label string, apis []types.Resource, version string) {

}

// UpdateEnforcerJWTIssuers sets new update to the enforcer's Applications
func UpdateEnforcerJWTIssuers(jwtIssuers *subscription.JWTIssuerList) {
logger.LoggerXds.Debug("Updating Enforcer JWT Issuer Cache")
label := commonEnforcerLabel
jwtIssuerList := append(enforcerLabelMap[label].jwtIssuers, jwtIssuers)

version, _ := crand.Int(crand.Reader, maxRandomBigInt())
snap, _ := wso2_cache.NewSnapshot(fmt.Sprint(version), map[wso2_resource.Type][]types.Resource{
wso2_resource.JWTIssuerListType: jwtIssuerList,
})
snap.Consistent()

errSetSnap := enforcerJwtIssuerCache.SetSnapshot(context.Background(), label, snap)
if errSetSnap != nil {
logger.LoggerXds.ErrorC(logging.PrintError(logging.Error1414, logging.MAJOR, "Error while setting the snapshot : %v", errSetSnap.Error()))
}
enforcerLabelMap[label].jwtIssuers = jwtIssuerList
logger.LoggerXds.Infof("New JWTIssuer cache update for the label: " + label + " version: " + fmt.Sprint(version))
}

// UpdateXdsCacheWithLock uses mutex and lock to avoid different go routines updating XDS at the same time
func UpdateXdsCacheWithLock(label string, endpoints []types.Resource, clusters []types.Resource, routes []types.Resource,
listeners []types.Resource) bool {
Expand Down
Loading

0 comments on commit d9f76dc

Please sign in to comment.