@ -37,14 +37,13 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value ;
import org.springframework.beans.factory.annotation.Value ;
import org.springframework.http.HttpStatus ;
import org.springframework.http.HttpStatus ;
import org.springframework.security.access.prepost.PreAuthorize ;
import org.springframework.security.access.prepost.PreAuthorize ;
import org.springframework.web.bind.annotation.DeleteMapping ;
import org.springframework.web.bind.annotation.GetMapping ;
import org.springframework.web.bind.annotation.GetMapping ;
import org.springframework.web.bind.annotation.PathVariable ;
import org.springframework.web.bind.annotation.PathVariable ;
import org.springframework.web.bind.annotation.PostMapping ;
import org.springframework.web.bind.annotation.PostMapping ;
import org.springframework.web.bind.annotation.RequestBody ;
import org.springframework.web.bind.annotation.RequestBody ;
import org.springframework.web.bind.annotation.RequestMapping ;
import org.springframework.web.bind.annotation.RequestMapping ;
import org.springframework.web.bind.annotation.RequestMethod ;
import org.springframework.web.bind.annotation.RequestParam ;
import org.springframework.web.bind.annotation.RequestParam ;
import org.springframework.web.bind.annotation.ResponseBody ;
import org.springframework.web.bind.annotation.ResponseStatus ;
import org.springframework.web.bind.annotation.ResponseStatus ;
import org.springframework.web.bind.annotation.RestController ;
import org.springframework.web.bind.annotation.RestController ;
import org.springframework.web.context.request.async.DeferredResult ;
import org.springframework.web.context.request.async.DeferredResult ;
@ -125,14 +124,13 @@ public class AdminController extends BaseController {
@ApiOperation ( value = "Get the Administration Settings object using key (getAdminSettings)" ,
@ApiOperation ( value = "Get the Administration Settings object using key (getAdminSettings)" ,
notes = "Get the Administration Settings object using specified string key. Referencing non-existing key will cause an error." + SYSTEM_AUTHORITY_PARAGRAPH )
notes = "Get the Administration Settings object using specified string key. Referencing non-existing key will cause an error." + SYSTEM_AUTHORITY_PARAGRAPH )
@PreAuthorize ( "hasAuthority('SYS_ADMIN')" )
@PreAuthorize ( "hasAuthority('SYS_ADMIN')" )
@RequestMapping ( value = "/settings/{key}" , method = RequestMethod . GET )
@GetMapping ( value = "/settings/{key}" )
@ResponseBody
public AdminSettings getAdminSettings (
public AdminSettings getAdminSettings (
@Parameter ( description = "A string value of the key (e.g. 'general' or 'mail')." )
@Parameter ( description = "A string value of the key (e.g. 'general' or 'mail')." )
@PathVariable ( "key" ) String key ) throws ThingsboardException {
@PathVariable ( "key" ) String key ) throws ThingsboardException {
accessControlService . checkPermission ( getCurrentUser ( ) , Resource . ADMIN_SETTINGS , Operation . READ ) ;
accessControlService . checkPermission ( getCurrentUser ( ) , Resource . ADMIN_SETTINGS , Operation . READ ) ;
AdminSettings adminSettings = checkNotNull ( adminSettingsService . findAdminSettingsByKey ( TenantId . SYS_TENANT_ID , key ) , "No Administration settings found for key: " + key ) ;
AdminSettings adminSettings = checkNotNull ( adminSettingsService . findAdminSettingsByKey ( TenantId . SYS_TENANT_ID , key ) , "No Administration settings found for key: " + key ) ;
if ( adminSettings . getKey ( ) . equals ( "mail" ) ) {
if ( adminSettings . getKey ( ) . equals ( MAIL_SETTINGS_KEY ) ) {
( ( ObjectNode ) adminSettings . getJsonValue ( ) ) . remove ( "password" ) ;
( ( ObjectNode ) adminSettings . getJsonValue ( ) ) . remove ( "password" ) ;
( ( ObjectNode ) adminSettings . getJsonValue ( ) ) . remove ( "refreshToken" ) ;
( ( ObjectNode ) adminSettings . getJsonValue ( ) ) . remove ( "refreshToken" ) ;
}
}
@ -144,15 +142,14 @@ public class AdminController extends BaseController {
"The Administration Settings Id will be present in the response. Specify the Administration Settings Id when you would like to update the Administration Settings. " +
"The Administration Settings Id will be present in the response. Specify the Administration Settings Id when you would like to update the Administration Settings. " +
"Referencing non-existing Administration Settings Id will cause an error." + SYSTEM_AUTHORITY_PARAGRAPH )
"Referencing non-existing Administration Settings Id will cause an error." + SYSTEM_AUTHORITY_PARAGRAPH )
@PreAuthorize ( "hasAuthority('SYS_ADMIN')" )
@PreAuthorize ( "hasAuthority('SYS_ADMIN')" )
@RequestMapping ( value = "/settings" , method = RequestMethod . POST )
@PostMapping ( value = "/settings" )
@ResponseBody
public AdminSettings saveAdminSettings (
public AdminSettings saveAdminSettings (
@Parameter ( description = "A JSON value representing the Administration Settings." )
@Parameter ( description = "A JSON value representing the Administration Settings." )
@RequestBody AdminSettings adminSettings ) throws ThingsboardException {
@RequestBody AdminSettings adminSettings ) throws ThingsboardException {
accessControlService . checkPermission ( getCurrentUser ( ) , Resource . ADMIN_SETTINGS , Operation . WRITE ) ;
accessControlService . checkPermission ( getCurrentUser ( ) , Resource . ADMIN_SETTINGS , Operation . WRITE ) ;
adminSettings . setTenantId ( getTenantId ( ) ) ;
adminSettings . setTenantId ( getTenantId ( ) ) ;
adminSettings = checkNotNull ( adminSettingsService . saveAdminSettings ( TenantId . SYS_TENANT_ID , adminSettings ) ) ;
adminSettings = checkNotNull ( adminSettingsService . saveAdminSettings ( TenantId . SYS_TENANT_ID , adminSettings ) ) ;
if ( adminSettings . getKey ( ) . equals ( "mail" ) ) {
if ( adminSettings . getKey ( ) . equals ( MAIL_SETTINGS_KEY ) ) {
mailService . updateMailConfiguration ( ) ;
mailService . updateMailConfiguration ( ) ;
( ( ObjectNode ) adminSettings . getJsonValue ( ) ) . remove ( "password" ) ;
( ( ObjectNode ) adminSettings . getJsonValue ( ) ) . remove ( "password" ) ;
( ( ObjectNode ) adminSettings . getJsonValue ( ) ) . remove ( "refreshToken" ) ;
( ( ObjectNode ) adminSettings . getJsonValue ( ) ) . remove ( "refreshToken" ) ;
@ -165,8 +162,7 @@ public class AdminController extends BaseController {
@ApiOperation ( value = "Get the Security Settings object (getSecuritySettings)" ,
@ApiOperation ( value = "Get the Security Settings object (getSecuritySettings)" ,
notes = "Get the Security Settings object that contains password policy, etc." + SYSTEM_AUTHORITY_PARAGRAPH )
notes = "Get the Security Settings object that contains password policy, etc." + SYSTEM_AUTHORITY_PARAGRAPH )
@PreAuthorize ( "hasAuthority('SYS_ADMIN')" )
@PreAuthorize ( "hasAuthority('SYS_ADMIN')" )
@RequestMapping ( value = "/securitySettings" , method = RequestMethod . GET )
@GetMapping ( value = "/securitySettings" )
@ResponseBody
public SecuritySettings getSecuritySettings ( ) throws ThingsboardException {
public SecuritySettings getSecuritySettings ( ) throws ThingsboardException {
accessControlService . checkPermission ( getCurrentUser ( ) , Resource . ADMIN_SETTINGS , Operation . READ ) ;
accessControlService . checkPermission ( getCurrentUser ( ) , Resource . ADMIN_SETTINGS , Operation . READ ) ;
return checkNotNull ( securitySettingsService . getSecuritySettings ( ) ) ;
return checkNotNull ( securitySettingsService . getSecuritySettings ( ) ) ;
@ -175,8 +171,7 @@ public class AdminController extends BaseController {
@ApiOperation ( value = "Update Security Settings (saveSecuritySettings)" ,
@ApiOperation ( value = "Update Security Settings (saveSecuritySettings)" ,
notes = "Updates the Security Settings object that contains password policy, etc." + SYSTEM_AUTHORITY_PARAGRAPH )
notes = "Updates the Security Settings object that contains password policy, etc." + SYSTEM_AUTHORITY_PARAGRAPH )
@PreAuthorize ( "hasAuthority('SYS_ADMIN')" )
@PreAuthorize ( "hasAuthority('SYS_ADMIN')" )
@RequestMapping ( value = "/securitySettings" , method = RequestMethod . POST )
@PostMapping ( value = "/securitySettings" )
@ResponseBody
public SecuritySettings saveSecuritySettings (
public SecuritySettings saveSecuritySettings (
@Parameter ( description = "A JSON value representing the Security Settings." )
@Parameter ( description = "A JSON value representing the Security Settings." )
@RequestBody SecuritySettings securitySettings ) throws ThingsboardException {
@RequestBody SecuritySettings securitySettings ) throws ThingsboardException {
@ -188,8 +183,7 @@ public class AdminController extends BaseController {
@ApiOperation ( value = "Get the JWT Settings object (getJwtSettings)" ,
@ApiOperation ( value = "Get the JWT Settings object (getJwtSettings)" ,
notes = "Get the JWT Settings object that contains JWT token policy, etc. " + SYSTEM_AUTHORITY_PARAGRAPH )
notes = "Get the JWT Settings object that contains JWT token policy, etc. " + SYSTEM_AUTHORITY_PARAGRAPH )
@PreAuthorize ( "hasAuthority('SYS_ADMIN')" )
@PreAuthorize ( "hasAuthority('SYS_ADMIN')" )
@RequestMapping ( value = "/jwtSettings" , method = RequestMethod . GET )
@GetMapping ( value = "/jwtSettings" )
@ResponseBody
public JwtSettings getJwtSettings ( ) throws ThingsboardException {
public JwtSettings getJwtSettings ( ) throws ThingsboardException {
accessControlService . checkPermission ( getCurrentUser ( ) , Resource . ADMIN_SETTINGS , Operation . READ ) ;
accessControlService . checkPermission ( getCurrentUser ( ) , Resource . ADMIN_SETTINGS , Operation . READ ) ;
return checkNotNull ( jwtSettingsService . getJwtSettings ( ) ) ;
return checkNotNull ( jwtSettingsService . getJwtSettings ( ) ) ;
@ -198,8 +192,7 @@ public class AdminController extends BaseController {
@ApiOperation ( value = "Update JWT Settings (saveJwtSettings)" ,
@ApiOperation ( value = "Update JWT Settings (saveJwtSettings)" ,
notes = "Updates the JWT Settings object that contains JWT token policy, etc. The tokenSigningKey field is a Base64 encoded string." + SYSTEM_AUTHORITY_PARAGRAPH )
notes = "Updates the JWT Settings object that contains JWT token policy, etc. The tokenSigningKey field is a Base64 encoded string." + SYSTEM_AUTHORITY_PARAGRAPH )
@PreAuthorize ( "hasAuthority('SYS_ADMIN')" )
@PreAuthorize ( "hasAuthority('SYS_ADMIN')" )
@RequestMapping ( value = "/jwtSettings" , method = RequestMethod . POST )
@PostMapping ( value = "/jwtSettings" )
@ResponseBody
public JwtPair saveJwtSettings (
public JwtPair saveJwtSettings (
@Parameter ( description = "A JSON value representing the JWT Settings." )
@Parameter ( description = "A JSON value representing the JWT Settings." )
@RequestBody JwtSettings jwtSettings ) throws ThingsboardException {
@RequestBody JwtSettings jwtSettings ) throws ThingsboardException {
@ -213,15 +206,15 @@ public class AdminController extends BaseController {
notes = "Attempts to send test email to the System Administrator User using Mail Settings provided as a parameter. " +
notes = "Attempts to send test email to the System Administrator User using Mail Settings provided as a parameter. " +
"You may change the 'To' email in the user profile of the System Administrator. " + SYSTEM_AUTHORITY_PARAGRAPH )
"You may change the 'To' email in the user profile of the System Administrator. " + SYSTEM_AUTHORITY_PARAGRAPH )
@PreAuthorize ( "hasAuthority('SYS_ADMIN')" )
@PreAuthorize ( "hasAuthority('SYS_ADMIN')" )
@Reque stMapping ( value = "/settings/testMail" , method = RequestMethod . POST )
@Po stMapping ( value = "/settings/testMail" )
public void sendTestMail (
public void sendTestMail (
@Parameter ( description = "A JSON value representing the Mail Settings." )
@Parameter ( description = "A JSON value representing the Mail Settings." )
@RequestBody AdminSettings adminSettings ) throws ThingsboardException {
@RequestBody AdminSettings adminSettings ) throws ThingsboardException {
accessControlService . checkPermission ( getCurrentUser ( ) , Resource . ADMIN_SETTINGS , Operation . READ ) ;
accessControlService . checkPermission ( getCurrentUser ( ) , Resource . ADMIN_SETTINGS , Operation . READ ) ;
adminSettings = checkNotNull ( adminSettings ) ;
adminSettings = checkNotNull ( adminSettings ) ;
if ( adminSettings . getKey ( ) . equals ( "mail" ) ) {
if ( adminSettings . getKey ( ) . equals ( MAIL_SETTINGS_KEY ) ) {
if ( adminSettings . getJsonValue ( ) . has ( "enableOauth2" ) & & adminSettings . getJsonValue ( ) . get ( "enableOauth2" ) . asBoolean ( ) ) {
if ( adminSettings . getJsonValue ( ) . has ( "enableOauth2" ) & & adminSettings . getJsonValue ( ) . get ( "enableOauth2" ) . asBoolean ( ) ) {
AdminSettings mailSettings = checkNotNull ( adminSettingsService . findAdminSettingsByKey ( TenantId . SYS_TENANT_ID , "mail" ) ) ;
AdminSettings mailSettings = checkNotNull ( adminSettingsService . findAdminSettingsByKey ( TenantId . SYS_TENANT_ID , MAIL_SETTINGS_KEY ) ) ;
JsonNode refreshToken = mailSettings . getJsonValue ( ) . get ( "refreshToken" ) ;
JsonNode refreshToken = mailSettings . getJsonValue ( ) . get ( "refreshToken" ) ;
if ( refreshToken = = null ) {
if ( refreshToken = = null ) {
throw new ThingsboardException ( "Refresh token was not generated. Please, generate refresh token." , ThingsboardErrorCode . GENERAL ) ;
throw new ThingsboardException ( "Refresh token was not generated. Please, generate refresh token." , ThingsboardErrorCode . GENERAL ) ;
@ -230,7 +223,7 @@ public class AdminController extends BaseController {
settings . put ( "refreshToken" , refreshToken . asText ( ) ) ;
settings . put ( "refreshToken" , refreshToken . asText ( ) ) ;
} else {
} else {
if ( ! adminSettings . getJsonValue ( ) . has ( "password" ) ) {
if ( ! adminSettings . getJsonValue ( ) . has ( "password" ) ) {
AdminSettings mailSettings = checkNotNull ( adminSettingsService . findAdminSettingsByKey ( TenantId . SYS_TENANT_ID , "mail" ) ) ;
AdminSettings mailSettings = checkNotNull ( adminSettingsService . findAdminSettingsByKey ( TenantId . SYS_TENANT_ID , MAIL_SETTINGS_KEY ) ) ;
( ( ObjectNode ) adminSettings . getJsonValue ( ) ) . put ( "password" , mailSettings . getJsonValue ( ) . get ( "password" ) . asText ( ) ) ;
( ( ObjectNode ) adminSettings . getJsonValue ( ) ) . put ( "password" , mailSettings . getJsonValue ( ) . get ( "password" ) . asText ( ) ) ;
}
}
}
}
@ -251,7 +244,7 @@ public class AdminController extends BaseController {
notes = "Attempts to send test sms to the System Administrator User using SMS Settings and phone number provided as a parameters of the request. "
notes = "Attempts to send test sms to the System Administrator User using SMS Settings and phone number provided as a parameters of the request. "
+ SYSTEM_AUTHORITY_PARAGRAPH )
+ SYSTEM_AUTHORITY_PARAGRAPH )
@PreAuthorize ( "hasAuthority('SYS_ADMIN')" )
@PreAuthorize ( "hasAuthority('SYS_ADMIN')" )
@Reque stMapping ( value = "/settings/testSms" , method = RequestMethod . POST )
@Po stMapping ( value = "/settings/testSms" )
public void sendTestSms (
public void sendTestSms (
@Parameter ( description = "A JSON value representing the Test SMS request." )
@Parameter ( description = "A JSON value representing the Test SMS request." )
@RequestBody TestSmsRequest testSmsRequest ) throws ThingsboardException {
@RequestBody TestSmsRequest testSmsRequest ) throws ThingsboardException {
@ -325,7 +318,7 @@ public class AdminController extends BaseController {
notes = "Deletes the repository settings."
notes = "Deletes the repository settings."
+ TENANT_AUTHORITY_PARAGRAPH )
+ TENANT_AUTHORITY_PARAGRAPH )
@PreAuthorize ( "hasAuthority('TENANT_ADMIN')" )
@PreAuthorize ( "hasAuthority('TENANT_ADMIN')" )
@Request Mapping ( value = "/repositorySettings" , method = RequestMethod . DELETE )
@Delete Mapping ( value = "/repositorySettings" )
@ResponseStatus ( value = HttpStatus . OK )
@ResponseStatus ( value = HttpStatus . OK )
public DeferredResult < Void > deleteRepositorySettings ( ) throws Exception {
public DeferredResult < Void > deleteRepositorySettings ( ) throws Exception {
accessControlService . checkPermission ( getCurrentUser ( ) , Resource . VERSION_CONTROL , Operation . DELETE ) ;
accessControlService . checkPermission ( getCurrentUser ( ) , Resource . VERSION_CONTROL , Operation . DELETE ) ;
@ -335,7 +328,7 @@ public class AdminController extends BaseController {
@ApiOperation ( value = "Check repository access (checkRepositoryAccess)" ,
@ApiOperation ( value = "Check repository access (checkRepositoryAccess)" ,
notes = "Attempts to check repository access. " + TENANT_AUTHORITY_PARAGRAPH )
notes = "Attempts to check repository access. " + TENANT_AUTHORITY_PARAGRAPH )
@PreAuthorize ( "hasAuthority('TENANT_ADMIN')" )
@PreAuthorize ( "hasAuthority('TENANT_ADMIN')" )
@Reque stMapping ( value = "/repositorySettings/checkAccess" , method = RequestMethod . POST )
@Po stMapping ( value = "/repositorySettings/checkAccess" )
public DeferredResult < Void > checkRepositoryAccess (
public DeferredResult < Void > checkRepositoryAccess (
@Parameter ( description = "A JSON value representing the Repository Settings." )
@Parameter ( description = "A JSON value representing the Repository Settings." )
@RequestBody RepositorySettings settings ) throws Exception {
@RequestBody RepositorySettings settings ) throws Exception {
@ -376,7 +369,7 @@ public class AdminController extends BaseController {
notes = "Deletes the auto commit settings."
notes = "Deletes the auto commit settings."
+ TENANT_AUTHORITY_PARAGRAPH )
+ TENANT_AUTHORITY_PARAGRAPH )
@PreAuthorize ( "hasAuthority('TENANT_ADMIN')" )
@PreAuthorize ( "hasAuthority('TENANT_ADMIN')" )
@Request Mapping ( value = "/autoCommitSettings" , method = RequestMethod . DELETE )
@Delete Mapping ( value = "/autoCommitSettings" )
@ResponseStatus ( value = HttpStatus . OK )
@ResponseStatus ( value = HttpStatus . OK )
public void deleteAutoCommitSettings ( ) throws ThingsboardException {
public void deleteAutoCommitSettings ( ) throws ThingsboardException {
accessControlService . checkPermission ( getCurrentUser ( ) , Resource . VERSION_CONTROL , Operation . DELETE ) ;
accessControlService . checkPermission ( getCurrentUser ( ) , Resource . VERSION_CONTROL , Operation . DELETE ) ;
@ -387,9 +380,8 @@ public class AdminController extends BaseController {
notes = "Check notifications about new platform releases. "
notes = "Check notifications about new platform releases. "
+ SYSTEM_AUTHORITY_PARAGRAPH )
+ SYSTEM_AUTHORITY_PARAGRAPH )
@PreAuthorize ( "hasAuthority('SYS_ADMIN')" )
@PreAuthorize ( "hasAuthority('SYS_ADMIN')" )
@RequestMapping ( value = "/updates" , method = RequestMethod . GET )
@GetMapping ( value = "/updates" )
@ResponseBody
public UpdateMessage checkUpdates ( ) {
public UpdateMessage checkUpdates ( ) throws ThingsboardException {
return updateService . checkUpdates ( ) ;
return updateService . checkUpdates ( ) ;
}
}
@ -397,9 +389,8 @@ public class AdminController extends BaseController {
notes = "Get main information about system. "
notes = "Get main information about system. "
+ SYSTEM_AUTHORITY_PARAGRAPH )
+ SYSTEM_AUTHORITY_PARAGRAPH )
@PreAuthorize ( "hasAuthority('SYS_ADMIN')" )
@PreAuthorize ( "hasAuthority('SYS_ADMIN')" )
@RequestMapping ( value = "/systemInfo" , method = RequestMethod . GET )
@GetMapping ( value = "/systemInfo" )
@ResponseBody
public SystemInfo getSystemInfo ( ) {
public SystemInfo getSystemInfo ( ) throws ThingsboardException {
return systemInfoService . getSystemInfo ( ) ;
return systemInfoService . getSystemInfo ( ) ;
}
}
@ -407,8 +398,7 @@ public class AdminController extends BaseController {
notes = "Get information about enabled/disabled features. "
notes = "Get information about enabled/disabled features. "
+ SYSTEM_AUTHORITY_PARAGRAPH )
+ SYSTEM_AUTHORITY_PARAGRAPH )
@PreAuthorize ( "hasAuthority('SYS_ADMIN')" )
@PreAuthorize ( "hasAuthority('SYS_ADMIN')" )
@RequestMapping ( value = "/featuresInfo" , method = RequestMethod . GET )
@GetMapping ( value = "/featuresInfo" )
@ResponseBody
public FeaturesInfo getFeaturesInfo ( ) {
public FeaturesInfo getFeaturesInfo ( ) {
return systemInfoService . getFeaturesInfo ( ) ;
return systemInfoService . getFeaturesInfo ( ) ;
}
}
@ -417,8 +407,7 @@ public class AdminController extends BaseController {
"double quotes. After successful authentication with OAuth2 provider and user consent for requested scope, it makes a redirect to this path so that the platform can do " +
"double quotes. After successful authentication with OAuth2 provider and user consent for requested scope, it makes a redirect to this path so that the platform can do " +
"further log in processing and generating access tokens. " + SYSTEM_AUTHORITY_PARAGRAPH )
"further log in processing and generating access tokens. " + SYSTEM_AUTHORITY_PARAGRAPH )
@PreAuthorize ( "hasAnyAuthority('SYS_ADMIN')" )
@PreAuthorize ( "hasAnyAuthority('SYS_ADMIN')" )
@RequestMapping ( value = "/mail/oauth2/loginProcessingUrl" , method = RequestMethod . GET )
@GetMapping ( value = "/mail/oauth2/loginProcessingUrl" )
@ResponseBody
public String getMailProcessingUrl ( ) throws ThingsboardException {
public String getMailProcessingUrl ( ) throws ThingsboardException {
accessControlService . checkPermission ( getCurrentUser ( ) , Resource . ADMIN_SETTINGS , Operation . READ ) ;
accessControlService . checkPermission ( getCurrentUser ( ) , Resource . ADMIN_SETTINGS , Operation . READ ) ;
return "\"/api/admin/mail/oauth2/code\"" ;
return "\"/api/admin/mail/oauth2/code\"" ;
@ -427,7 +416,7 @@ public class AdminController extends BaseController {
@ApiOperation ( value = "Redirect user to mail provider login page. " , notes = "After user logged in and provided access" +
@ApiOperation ( value = "Redirect user to mail provider login page. " , notes = "After user logged in and provided access" +
"provider sends authorization code to specified redirect uri.)" )
"provider sends authorization code to specified redirect uri.)" )
@PreAuthorize ( "hasAuthority('SYS_ADMIN')" )
@PreAuthorize ( "hasAuthority('SYS_ADMIN')" )
@Reques tMapping ( value = "/mail/oauth2/authorize" , method = RequestMethod . GET , produces = "application/text" )
@Ge tMapping ( value = "/mail/oauth2/authorize" , produces = "application/text" )
public String getAuthorizationUrl ( HttpServletRequest request , HttpServletResponse response ) throws ThingsboardException {
public String getAuthorizationUrl ( HttpServletRequest request , HttpServletResponse response ) throws ThingsboardException {
String state = StringUtils . generateSafeToken ( ) ;
String state = StringUtils . generateSafeToken ( ) ;
if ( request . getParameter ( PREV_URI_PATH_PARAMETER ) ! = null ) {
if ( request . getParameter ( PREV_URI_PATH_PARAMETER ) ! = null ) {
@ -452,7 +441,7 @@ public class AdminController extends BaseController {
. build ( ) + "\"" ;
. build ( ) + "\"" ;
}
}
@Reques tMapping ( value = "/mail/oauth2/code" , params = { "code" , "state" } , method = RequestMethod . GET )
@Ge tMapping ( value = "/mail/oauth2/code" , params = { "code" , "state" } )
public void codeProcessingUrl (
public void codeProcessingUrl (
@RequestParam ( value = "code" ) String code , @RequestParam ( value = "state" ) String state ,
@RequestParam ( value = "code" ) String code , @RequestParam ( value = "state" ) String state ,
HttpServletRequest request , HttpServletResponse response ) throws ThingsboardException , IOException {
HttpServletRequest request , HttpServletResponse response ) throws ThingsboardException , IOException {