import io.swagger.v3.oas.annotations.servers.Servers;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.tags.Tags;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
@Controller
public class UserAdminServlet extends BeGenericServlet {
- private static final String UTF_8 = "UTF-8";
private static final String ROLE_DELIMITER = ",";
private static final Logger log = Logger.getLogger(UserAdminServlet.class);
private final UserBusinessLogic userBusinessLogic;
@ApiResponse(responseCode = "500", description = "Internal Server Error")})
@PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE)
public User authorize(@HeaderParam(value = Constants.USER_ID_HEADER) String userId, @HeaderParam("HTTP_CSP_FIRSTNAME") String firstName,
- @HeaderParam("HTTP_CSP_LASTNAME") String lastName, @HeaderParam("HTTP_CSP_EMAIL") String email)
- throws UnsupportedEncodingException {
- userId = userId != null ? URLDecoder.decode(userId, UTF_8) : null;
- firstName = firstName != null ? URLDecoder.decode(firstName, UTF_8) : null;
- lastName = lastName != null ? URLDecoder.decode(lastName, UTF_8) : null;
- email = email != null ? URLDecoder.decode(email, UTF_8) : null;
+ @HeaderParam("HTTP_CSP_LASTNAME") String lastName, @HeaderParam("HTTP_CSP_EMAIL") String email) {
User authUser = new User();
authUser.setUserId(userId);
authUser.setFirstName(firstName);
package org.openecomp.sdc.webseal.simulator;
+import static java.nio.charset.StandardCharsets.UTF_8;
+
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
return contextPaths;
}
- private String getUri(HttpServletRequest request, Map<String, String[]> requestParameters) throws UnsupportedEncodingException {
+ private String getUri(HttpServletRequest request, Map<String, String[]> requestParameters) {
String suffix = request.getRequestURI();
if (getContextPaths().stream().anyMatch(request.getRequestURI()::contains)) {
suffix = alignUrlProxy(suffix);
return SDC1 + requestURI;
}
- private StringBuilder alignUrlParameters(Map<String, String[]> requestParameters) throws UnsupportedEncodingException {
+ private StringBuilder alignUrlParameters(Map<String, String[]> requestParameters) {
final var query = new StringBuilder();
for (final Entry<String, String[]> entry : requestParameters.entrySet()) {
for (final String value : entry.getValue()) {
} else {
query.append("&");
}
- query.append(String.format("&%s=%s", URLEncoder.encode(entry.getKey(), "UTF-8"), URLEncoder.encode(value, "UTF-8")));
+ query.append(String.format("&%s=%s", URLEncoder.encode(entry.getKey(), UTF_8), URLEncoder.encode(value, UTF_8)));
}
}
return query;