8000 Release v1.42.1 · gofr-dev/gofr · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

v1.42.1

Latest
Compare
Choose a tag to compare
7463
@Umang01-hash Umang01-hash released this 27 Jun 12:42
· 0 commits to development since this release
2decc18

v1.42.1

🛠️ Improvements

1. NewOAuthConfig() for Safer OAuth Setup

GoFr now includes a dedicated constructor to validate OAuth configurations for interservice HTTP calls, ensuring secure and consistent authentication setup. Refer to the official documentation to know more :

NewOAuthConfig(
	clientID,  // string: OAuth2 client ID (required)
	secret,    // string: OAuth2 client secret (required)
	tokenURL,  // string: Token exchange endpoint (required & validated)
	scopes,    // []string: Optional OAuth2 scopes
	params,    // url.Values: Optional additional endpoint parameters
	authStyle, // oauth2.AuthStyle: Credential passing style (header/body/auto)
)

🔍 Why this matters:

  • Prevents common misconfigurations like missing tokenURL, which previously caused vague errors such as:

    Post "": unsupported protocol scheme ""
    
  • Performs validation on required fields and returns clear error messages.

  • Encourages safe and standardized OAuth client setup.

✅ Example Usage:

config, err := NewOAuthConfig(
	"my-client-id",                       // clientID
	"my-client-secret",                   // secret
	"https://provider.com/oauth/token",  // tokenURL
	[]string{"read", "write"},           // scopes
	nil,                                  // params
	oauth2.AuthStyleAutoDetect,          // authStyle
)

if err != nil {
	log.Fatal(err)
}

Refer to the official documentation to know more.

2. Configurable AuthStyle in OAuth

The AuthStyle field in OAuth2 configuration is now configurable by the user.

🔧 Behavior:

  • Previously hardcoded to oauth2.AuthStyleInHeader

  • Now allows values such as:

    • oauth2.AuthStyleAutoDetect (default)
    • oauth2.AuthStyleInHeader
    • oauth2.AuthStyleInParams

This makes GoFr's OAuth integration more flexible and compatible with diverse OAuth providers.


3. Versioned Migrations in Kafka, MQTT, and Google PubSub

GoFr now supports versioned migrations for the following data sources:

  • Kafka
  • MQTT
  • Google PubSub

🧩 Additional Config (MQTT only):

To support retained message fetching for versioned migrations in MQTT, enable:

MQTT_RETRIEVE_RETAINED=true

By default, this is set to false to maintain backward compatibility. When set to true, this actually retains the latest message for each topics in the connected MQTT host, hence aiding in versioned migrations.

0