Allowing anonymous connections
Updating rule to allow an anonymous connection without credentials Signed-off-by: TKTheTechie <thomas.kunnumpurath@solace.com>
This commit is contained in:
		
							parent
							
								
									57c2324670
								
							
						
					
					
						commit
						a5dfcb80fa
					
				|  | @ -62,7 +62,7 @@ func isValidPEM(val string) bool { | |||
| } | ||||
| 
 | ||||
| func parseAMQPMetaData(md pubsub.Metadata, log logger.Logger) (*metadata, error) { | ||||
| 	m := metadata{} | ||||
| 	m := metadata{anonymous: false} | ||||
| 
 | ||||
| 	// required configuration settings
 | ||||
| 	if val, ok := md.Properties[amqpUrl]; ok && val != "" { | ||||
|  | @ -71,6 +71,17 @@ func parseAMQPMetaData(md pubsub.Metadata, log logger.Logger) (*metadata, error) | |||
| 		return &m, fmt.Errorf("%s missing url", errorMsgPrefix) | ||||
| 	} | ||||
| 
 | ||||
| 	// optional configuration settings
 | ||||
| 	if val, ok := md.Properties[anonymous]; ok && val != "" { | ||||
| 		var err error | ||||
| 		m.anonymous, err = strconv.ParseBool(val) | ||||
| 		if err != nil { | ||||
| 			return &m, fmt.Errorf("%s invalid anonymous %s, %s", errorMsgPrefix, val, err) | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	if !m.anonymous { | ||||
| 
 | ||||
| 		if val, ok := md.Properties[username]; ok && val != "" { | ||||
| 			m.username = val | ||||
| 		} else { | ||||
|  | @ -82,15 +93,8 @@ func parseAMQPMetaData(md pubsub.Metadata, log logger.Logger) (*metadata, error) | |||
| 		} else { | ||||
| 			return &m, fmt.Errorf("%s missing username", errorMsgPrefix) | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	// optional configuration settings
 | ||||
| 	if val, ok := md.Properties[anonymous]; ok && val != "" { | ||||
| 		var err error | ||||
| 		m.anonymous, err = strconv.ParseBool(val) | ||||
| 		if err != nil { | ||||
| 			return &m, fmt.Errorf("%s invalid anonymous %s, %s", errorMsgPrefix, val, err) | ||||
| 		} | ||||
| 	} | ||||
| 	if val, ok := md.Properties[amqpCACert]; ok && val != "" { | ||||
| 		if !isValidPEM(val) { | ||||
| 			return &m, fmt.Errorf("%s invalid caCert", errorMsgPrefix) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue