-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ZCS-15588: Added SOAP API for ChangePassword for Admin namespace
- Loading branch information
1 parent
a680f3b
commit 32da14c
Showing
12 changed files
with
362 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
113 changes: 113 additions & 0 deletions
113
soap/src/java/com/zimbra/soap/admin/message/ChangePasswordRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
/* | ||
* ***** BEGIN LICENSE BLOCK ***** | ||
* Zimbra Collaboration Suite Server | ||
* Copyright (C) 2024 Synacor, Inc. | ||
* | ||
* This program is free software: you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License as published by the Free Software Foundation, | ||
* version 2 of the License. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | ||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the GNU General Public License for more details. | ||
* You should have received a copy of the GNU General Public License along with this program. | ||
* If not, see <https://www.gnu.org/licenses/>. | ||
* ***** END LICENSE BLOCK ***** | ||
*/ | ||
package com.zimbra.soap.admin.message; | ||
|
||
import com.zimbra.common.soap.AccountConstants; | ||
import com.zimbra.common.soap.AdminConstants; | ||
import com.zimbra.soap.account.type.AuthToken; | ||
import com.zimbra.soap.type.AccountSelector; | ||
|
||
import javax.xml.bind.annotation.XmlElement; | ||
import javax.xml.bind.annotation.XmlRootElement; | ||
import javax.xml.bind.annotation.XmlType; | ||
|
||
@XmlRootElement(name= AdminConstants.E_CHANGE_PASSWORD_REQUEST) | ||
@XmlType(propOrder = {}) | ||
public class ChangePasswordRequest { | ||
/** | ||
* @zm-api-field-description Details of the account | ||
*/ | ||
@XmlElement(name=AccountConstants.E_ACCOUNT, required=true) | ||
private AccountSelector account; | ||
/** | ||
* @zm-api-field-description Old password | ||
*/ | ||
@XmlElement(name=AccountConstants.E_OLD_PASSWORD, required=true) | ||
private String oldPassword; | ||
/** | ||
* @zm-api-field-description New Password to assign | ||
*/ | ||
@XmlElement(name=AccountConstants.E_PASSWORD, required=true) | ||
private String password; | ||
/** | ||
* @zm-api-field-tag virtual-host | ||
* @zm-api-field-description if specified virtual-host is used to determine the domain of the account name, | ||
* if it does not include a domain component. For example, if the domain foo.com has a zimbraVirtualHostname of | ||
* "mail.foo.com", and an auth request comes in for "joe" with a virtualHost of "mail.foo.com", then the request | ||
* will be equivalent to logging in with "joe@foo.com". | ||
*/ | ||
@XmlElement(name=AccountConstants.E_VIRTUAL_HOST, required=false) | ||
private String virtualHost; | ||
|
||
@XmlElement(name=AccountConstants.E_DRYRUN, required=false) | ||
private boolean dryRun; | ||
|
||
@XmlElement(name=AccountConstants.E_AUTH_TOKEN /* authToken */, required=false) | ||
private AuthToken authToken; | ||
|
||
public ChangePasswordRequest() { | ||
} | ||
|
||
public ChangePasswordRequest(AccountSelector account, String oldPassword, String newPassword) { | ||
setAccount(account); | ||
setOldPassword(oldPassword); | ||
setPassword(newPassword); | ||
} | ||
|
||
public ChangePasswordRequest(AccountSelector account, String oldPassword, String newPassword, boolean dryRun) { | ||
setAccount(account); | ||
setOldPassword(oldPassword); | ||
setPassword(newPassword); | ||
setDryRun(dryRun); | ||
} | ||
|
||
public AccountSelector getAccount() { return account; } | ||
public String oldPassword() { return oldPassword; } | ||
public String getPassword() { return password; } | ||
public String getVirtualHost() { return virtualHost; } | ||
|
||
public ChangePasswordRequest setAccount(AccountSelector account) { | ||
this.account = account; | ||
return this; | ||
} | ||
|
||
public ChangePasswordRequest setOldPassword(String oldPassword) { | ||
this.oldPassword = oldPassword; | ||
return this; | ||
} | ||
|
||
public ChangePasswordRequest setPassword(String password) { | ||
this.password = password; | ||
return this; | ||
} | ||
|
||
public ChangePasswordRequest setVirtualHost(String host) { | ||
virtualHost = host; | ||
return this; | ||
} | ||
|
||
public boolean isDryRun() { | ||
return dryRun; | ||
} | ||
|
||
public void setDryRun(boolean dryRun) { | ||
this.dryRun = dryRun; | ||
} | ||
|
||
public AuthToken getAuthToken() { return authToken; } | ||
public ChangePasswordRequest setAuthToken(AuthToken authToken) { this.authToken = authToken; return this; } | ||
} |
65 changes: 65 additions & 0 deletions
65
soap/src/java/com/zimbra/soap/admin/message/ChangePasswordResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* ***** BEGIN LICENSE BLOCK ***** | ||
* Zimbra Collaboration Suite Server | ||
* Copyright (C) 2024 Synacor, Inc. | ||
* | ||
* This program is free software: you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License as published by the Free Software Foundation, | ||
* version 2 of the License. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | ||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the GNU General Public License for more details. | ||
* You should have received a copy of the GNU General Public License along with this program. | ||
* If not, see <https://www.gnu.org/licenses/>. | ||
* ***** END LICENSE BLOCK ***** | ||
*/ | ||
package com.zimbra.soap.admin.message; | ||
|
||
import com.zimbra.common.gql.GqlConstants; | ||
import com.zimbra.common.soap.AccountConstants; | ||
import com.zimbra.common.soap.AdminConstants; | ||
import com.zimbra.soap.json.jackson.annotate.ZimbraJsonAttribute; | ||
import io.leangen.graphql.annotations.GraphQLQuery; | ||
import io.leangen.graphql.annotations.types.GraphQLType; | ||
|
||
import javax.xml.bind.annotation.XmlElement; | ||
import javax.xml.bind.annotation.XmlRootElement; | ||
import javax.xml.bind.annotation.XmlType; | ||
|
||
@XmlRootElement(name= AdminConstants.E_CHANGE_PASSWORD_RESPONSE) | ||
@GraphQLType(name= GqlConstants.CLASS_CHANGE_PASSWORD_RESPONSE, description="The response to change password request.") | ||
@XmlType(propOrder = {}) | ||
public class ChangePasswordResponse { | ||
|
||
/** | ||
* @zm-api-field-tag new-auth-token | ||
* @zm-api-field-description New authToken, as old authToken is invalidated on password change. | ||
*/ | ||
@XmlElement(name=AccountConstants.E_AUTH_TOKEN /* authToken */, required=true) | ||
private String authToken; | ||
/** | ||
* @zm-api-field-description Life time associated with <b>{new-auth-token}</b> | ||
*/ | ||
@ZimbraJsonAttribute | ||
@XmlElement(name=AccountConstants.E_LIFETIME /* lifetime */, required=true) | ||
private long lifetime; | ||
|
||
public ChangePasswordResponse() { | ||
} | ||
|
||
@GraphQLQuery(name=GqlConstants.AUTH_TOKEN, description="Auth token based on the new password") | ||
public String getAuthToken() { return authToken; } | ||
@GraphQLQuery(name=GqlConstants.LIFETIME, description="Life time of the auth token") | ||
public long getLifetime() { return lifetime; } | ||
|
||
public ChangePasswordResponse setAuthToken(String authToken) { | ||
this.authToken = authToken; | ||
return this; | ||
} | ||
|
||
public ChangePasswordResponse setLifetime(long lifetime) { | ||
this.lifetime = lifetime; | ||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.