mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
ACS 9185 implement rest api for reauthorizing a single user (#3190)
* ACS-9185 Reauthorize endpoint * ACS-9185 Add the reauthorization code endpoint * ACS-9185 Refactored model * ACS-9185 Fixed rest wrapper implementation --------- Co-authored-by: Damian Ujma <damian.ujma@hyland.com>
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2025 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
/**
|
||||
* An object representing user authorization code.
|
||||
*/
|
||||
public record AuthCode(String authorizationCode)
|
||||
{}
|
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2025 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.rest.api.model;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.length;
|
||||
|
||||
/**
|
||||
* An object representing user authorization key request body.
|
||||
*/
|
||||
public record AuthKey(String authorizationKey)
|
||||
{
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
// for security reasons the key content should be never logged
|
||||
return "AuthKey[" +
|
||||
"authorizationKeyLength=" + length(authorizationKey) +
|
||||
']';
|
||||
}
|
||||
}
|
@@ -34,6 +34,8 @@ import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.rest.api.People;
|
||||
import org.alfresco.rest.api.model.AuthCode;
|
||||
import org.alfresco.rest.api.model.AuthKey;
|
||||
import org.alfresco.rest.api.model.Client;
|
||||
import org.alfresco.rest.api.model.PasswordReset;
|
||||
import org.alfresco.rest.api.model.Person;
|
||||
@@ -245,4 +247,29 @@ public class PeopleEntityResource implements EntityResourceAction.ReadById<Perso
|
||||
{
|
||||
// functionality is not implemented in community edition
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the authorization code.
|
||||
*
|
||||
* Not supported in community edition.
|
||||
*/
|
||||
@Operation("reauthorization-code")
|
||||
@WebApiDescription(title = "Get the reauthorization code", description = "Get the reauthorization code", successStatus = HttpServletResponse.SC_NOT_IMPLEMENTED)
|
||||
public AuthCode getReauthorizationCode(String personId, Void body, Parameters parameters, WithResponse withResponse)
|
||||
{
|
||||
// functionality is not implemented in community edition
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reauthorize user.
|
||||
*
|
||||
* Not supported in community edition.
|
||||
*/
|
||||
@Operation("reauthorize")
|
||||
@WebApiDescription(title = "Reauthorize user", description = "Performs user reauthorization", successStatus = HttpServletResponse.SC_NOT_IMPLEMENTED)
|
||||
public void reauthorizeUser(String personId, AuthKey authKey, Parameters parameters, WithResponse withResponse)
|
||||
{
|
||||
// functionality is not implemented in community edition
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user