Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions sdk/spring/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Release History

## 6.2.0-beta.1 (Unreleased)

### Spring Cloud Azure Autoconfigure
This section includes changes in `spring-cloud-azure-autoconfigure` module.

#### Bugs Fixed

- Fix `ClassNotFoundException: com.nimbusds.oauth2.sdk.util.StringUtils` in Active Directory starter. ([#47600](https://github.com/Azure/azure-sdk-for-java/issues/47600))

## 6.1.0 (2025-12-16)
- This release is compatible with Spring Boot 3.5.0-3.5.8. (Note: 3.5.x (x>8) should be supported, but they aren't tested with this release.)
- This release is compatible with Spring Cloud 2025.0.0. (Note: 2025.0.x (x>0) should be supported, but they aren't tested with this release.)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

package com.azure.spring.cloud.autoconfigure.implementation.aad.security.properties;

import com.nimbusds.oauth2.sdk.util.StringUtils;
import org.springframework.util.StringUtils;

/**
* Used to get endpoints for Microsoft Identity authorization server.
Expand All @@ -27,7 +27,7 @@ public class AadAuthorizationServerEndpoints {
* @param tenantId the tenant ID
*/
public AadAuthorizationServerEndpoints(String baseUri, String tenantId) {
if (StringUtils.isBlank(baseUri)) {
if (!StringUtils.hasText(baseUri)) {
baseUri = DEFAULT_BASE_URI;
}
this.baseUri = addSlash(baseUri);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.spring.cloud.autoconfigure.implementation.aad.security.properties;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

class AadAuthorizationServerEndpointsTests {

private static final String DEFAULT_BASE_URI = "https://login.microsoftonline.com/";
private static final String CUSTOM_BASE_URI = "https://custom.endpoint.com/";
private static final String TENANT_ID = "test-tenant-id";

@Test
void constructorWithNullBaseUri() {
AadAuthorizationServerEndpoints endpoints = new AadAuthorizationServerEndpoints(null, TENANT_ID);
assertEquals(DEFAULT_BASE_URI, endpoints.getBaseUri());
}

@Test
void constructorWithEmptyBaseUri() {
AadAuthorizationServerEndpoints endpoints = new AadAuthorizationServerEndpoints("", TENANT_ID);
assertEquals(DEFAULT_BASE_URI, endpoints.getBaseUri());
}

@Test
void constructorWithWhitespaceBaseUri() {
AadAuthorizationServerEndpoints endpoints = new AadAuthorizationServerEndpoints(" ", TENANT_ID);
assertEquals(DEFAULT_BASE_URI, endpoints.getBaseUri());
}

@Test
void constructorWithValidBaseUri() {
AadAuthorizationServerEndpoints endpoints = new AadAuthorizationServerEndpoints(CUSTOM_BASE_URI, TENANT_ID);
assertEquals(CUSTOM_BASE_URI, endpoints.getBaseUri());
}

@Test
void constructorWithBaseUriWithoutTrailingSlash() {
String baseUriWithoutSlash = "https://custom.endpoint.com";
AadAuthorizationServerEndpoints endpoints = new AadAuthorizationServerEndpoints(baseUriWithoutSlash, TENANT_ID);
assertEquals(baseUriWithoutSlash + "/", endpoints.getBaseUri());
}

@Test
void getAuthorizationEndpoint() {
AadAuthorizationServerEndpoints endpoints = new AadAuthorizationServerEndpoints(DEFAULT_BASE_URI, TENANT_ID);
String authEndpoint = endpoints.getAuthorizationEndpoint();
assertEquals(DEFAULT_BASE_URI + TENANT_ID + "/oauth2/v2.0/authorize", authEndpoint);
}

@Test
void getTokenEndpoint() {
AadAuthorizationServerEndpoints endpoints = new AadAuthorizationServerEndpoints(DEFAULT_BASE_URI, TENANT_ID);
String tokenEndpoint = endpoints.getTokenEndpoint();
assertEquals(DEFAULT_BASE_URI + TENANT_ID + "/oauth2/v2.0/token", tokenEndpoint);
}

@Test
void getJwkSetEndpoint() {
AadAuthorizationServerEndpoints endpoints = new AadAuthorizationServerEndpoints(DEFAULT_BASE_URI, TENANT_ID);
String jwkSetEndpoint = endpoints.getJwkSetEndpoint();
assertEquals(DEFAULT_BASE_URI + TENANT_ID + "/discovery/v2.0/keys", jwkSetEndpoint);
}

@Test
void getEndSessionEndpoint() {
AadAuthorizationServerEndpoints endpoints = new AadAuthorizationServerEndpoints(DEFAULT_BASE_URI, TENANT_ID);
String endSessionEndpoint = endpoints.getEndSessionEndpoint();
assertEquals(DEFAULT_BASE_URI + TENANT_ID + "/oauth2/v2.0/logout", endSessionEndpoint);
}
}
Loading