Refactor DefaultSmsService
This commit is contained in:
parent
63dd915e1b
commit
2eb043f291
@ -121,7 +121,7 @@ public class Oauth2AuthenticationSuccessHandler extends SimpleUrlAuthenticationS
|
||||
errorPrefix = "/login?loginError=";
|
||||
}
|
||||
getRedirectStrategy().sendRedirect(request, response, baseUrl + errorPrefix +
|
||||
URLEncoder.encode(e.getMessage(), StandardCharsets.UTF_8.toString()));
|
||||
URLEncoder.encode(e.getMessage(), StandardCharsets.UTF_8));
|
||||
}
|
||||
}
|
||||
|
||||
@ -138,4 +138,5 @@ public class Oauth2AuthenticationSuccessHandler extends SimpleUrlAuthenticationS
|
||||
}
|
||||
return baseUrl + "accessToken=" + tokenPair.getToken() + "&refreshToken=" + tokenPair.getRefreshToken();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -18,6 +18,7 @@ package org.thingsboard.server.service.sms;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import jakarta.annotation.PreDestroy;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.core.NestedRuntimeException;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -37,8 +38,9 @@ import org.thingsboard.server.common.stats.TbApiUsageReportClient;
|
||||
import org.thingsboard.server.dao.settings.AdminSettingsService;
|
||||
import org.thingsboard.server.service.apiusage.TbApiUsageStateService;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DefaultSmsService implements SmsService {
|
||||
|
||||
private final SmsSenderFactory smsSenderFactory;
|
||||
@ -48,13 +50,6 @@ public class DefaultSmsService implements SmsService {
|
||||
|
||||
private SmsSender smsSender;
|
||||
|
||||
public DefaultSmsService(SmsSenderFactory smsSenderFactory, AdminSettingsService adminSettingsService, TbApiUsageStateService apiUsageStateService, TbApiUsageReportClient apiUsageClient) {
|
||||
this.smsSenderFactory = smsSenderFactory;
|
||||
this.adminSettingsService = adminSettingsService;
|
||||
this.apiUsageStateService = apiUsageStateService;
|
||||
this.apiUsageClient = apiUsageClient;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
private void init() {
|
||||
updateSmsConfiguration();
|
||||
@ -148,4 +143,5 @@ public class DefaultSmsService implements SmsService {
|
||||
return new ThingsboardException(String.format("Unable to send SMS: %s", message),
|
||||
ThingsboardErrorCode.GENERAL);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -29,6 +29,7 @@ import java.util.UUID;
|
||||
|
||||
@Component
|
||||
public class HybridClientRegistrationRepository implements ClientRegistrationRepository {
|
||||
|
||||
private static final String defaultRedirectUriTemplate = "{baseUrl}/login/oauth2/code/{registrationId}";
|
||||
|
||||
@Autowired
|
||||
@ -43,7 +44,7 @@ public class HybridClientRegistrationRepository implements ClientRegistrationRep
|
||||
return toSpringClientRegistration(oAuth2Client);
|
||||
}
|
||||
|
||||
private ClientRegistration toSpringClientRegistration(OAuth2Client oAuth2Client){
|
||||
private ClientRegistration toSpringClientRegistration(OAuth2Client oAuth2Client) {
|
||||
String registrationId = oAuth2Client.getUuidId().toString();
|
||||
|
||||
// NONE is used if we need pkce-based code challenge
|
||||
@ -69,4 +70,5 @@ public class HybridClientRegistrationRepository implements ClientRegistrationRep
|
||||
.redirectUri(defaultRedirectUriTemplate)
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user