+
+ if trustedInvoker, ok := s.trustedInvokers[apiInvokerId]; ok {
+ updatedInvoker := s.checkParams(trustedInvoker, params)
+ if updatedInvoker != nil {
+ err := ctx.JSON(http.StatusOK, updatedInvoker)
+ if err != nil {
+ return err
+ }
+ }
+ } else {
+ return sendCoreError(ctx, http.StatusNotFound, fmt.Sprintf("invoker %s not registered as trusted invoker", apiInvokerId))
+ }
+
+ return nil
+}
+
+func (s *Security) checkParams(trustedInvoker securityapi.ServiceSecurity, params securityapi.GetTrustedInvokersApiInvokerIdParams) *securityapi.ServiceSecurity {
+ emptyString := ""
+
+ var sendAuthenticationInfo = (params.AuthenticationInfo != nil) && *params.AuthenticationInfo
+ var sendAuthorizationInfo = (params.AuthorizationInfo != nil) && *params.AuthorizationInfo
+
+ if sendAuthenticationInfo && sendAuthorizationInfo {
+ return &trustedInvoker
+ }
+
+ data, _ := copystructure.Copy(trustedInvoker)
+ updatedInvoker, ok := data.(securityapi.ServiceSecurity)
+ if !ok {
+ return nil
+ }
+
+ if !sendAuthenticationInfo {
+ for i := range updatedInvoker.SecurityInfo {
+ updatedInvoker.SecurityInfo[i].AuthenticationInfo = &emptyString
+ }
+ }
+ if !sendAuthorizationInfo {
+ for i := range updatedInvoker.SecurityInfo {
+ updatedInvoker.SecurityInfo[i].AuthorizationInfo = &emptyString
+ }
+ }
+ return &updatedInvoker