Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to boot 3.0 #3076

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.cloudfoundry.identity.uaa.util.JsonUtils;
import org.springframework.util.StringUtils;

import javax.validation.constraints.NotNull;
import jakarta.validation.constraints.NotNull;
import java.io.IOException;
import java.util.Date;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import java.io.IOException;
import java.util.Date;

import javax.validation.constraints.NotNull;
import jakarta.validation.constraints.NotNull;

import org.cloudfoundry.identity.uaa.util.JsonUtils;
import org.springframework.util.StringUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import org.cloudfoundry.identity.uaa.constants.OriginKeys;

import javax.validation.constraints.NotNull;
import jakarta.validation.constraints.NotNull;
import java.util.Calendar;
import java.util.Date;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.View;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStreamReader;
import java.security.Principal;
Expand Down Expand Up @@ -52,7 +52,7 @@ public void setInfo(Resource info) {
}
}

@RequestMapping("/info")
@RequestMapping({"/info", "/info/"})
public View info(Map<String, Object> model, Principal principal) {
model.put("loginUrl", loginUrl);
model.put("uaaUrl", uaaUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
import java.util.HashMap;
import java.util.Map;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.Filter;
import jakarta.servlet.FilterChain;
import jakarta.servlet.FilterConfig;
import jakarta.servlet.ServletException;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;
import jakarta.servlet.http.HttpServletRequest;

/**
* A servlet filter that adds a content type header to any path that matches one
Expand Down
4 changes: 2 additions & 2 deletions samples/api/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
you under the Apache License, Version 2.0 (the "License"). You may not use this product except in compliance with the License.
This product includes a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents
is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. -->
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
<web-app xmlns="https://jakarta.ee/xml/ns/jakartaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd" version="6.0">

<filter>
<filter-name>springSecurityFilterChain</filter-name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.http.client.config.CookieSpecs;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.config.RequestConfig.Builder;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.protocol.HttpContext;
import org.apache.hc.client5.http.config.RequestConfig;
import org.apache.hc.client5.http.config.RequestConfig.Builder;
import org.apache.hc.client5.http.cookie.StandardCookieSpec;
import org.apache.hc.client5.http.protocol.HttpClientContext;
import org.apache.hc.core5.http.protocol.HttpContext;
import org.cloudfoundry.identity.uaa.oauth.client.DefaultOAuth2ClientContext;
import org.cloudfoundry.identity.uaa.oauth.client.OAuth2ClientContext;
import org.cloudfoundry.identity.uaa.oauth.client.OAuth2RestTemplate;
Expand Down Expand Up @@ -335,7 +335,7 @@ protected HttpContext createHttpContext(HttpMethod httpMethod, URI uri) {

protected RequestConfig getRequestConfig() {
Builder builder = RequestConfig.custom()
.setCookieSpec(CookieSpecs.IGNORE_COOKIES)
.setCookieSpec(StandardCookieSpec.IGNORE)
.setAuthenticationEnabled(false).setRedirectsEnabled(false);
return builder.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequest;
import java.security.Principal;

@Controller
Expand Down Expand Up @@ -67,15 +67,15 @@ public void setClientId(String clientId) {
this.clientId = clientId;
}

@RequestMapping("/browse")
@RequestMapping({"/browse", "/browse/"})
public String browse(Model model) {
model.addAttribute("userAuthorizationUri", userAuthorizationUri);
model.addAttribute("clientId", clientId);
model.addAttribute("dataUri", dataUri);
return "browse";
}

@RequestMapping("/home")
@RequestMapping({"/home", "/home/"})
public String home(Model model, Principal principal) {
model.addAttribute("principal", principal);
model.addAttribute("approvalsUri", approvalsUri);
Expand All @@ -84,13 +84,13 @@ public String home(Model model, Principal principal) {

// Home page with just the user id - useful for testing simplest possible
// use case
@RequestMapping("/id")
@RequestMapping({"/id", "/id/"})
public String id(Model model, Principal principal) {
model.addAttribute("principal", principal);
return "home";
}

@RequestMapping("/logout")
@RequestMapping({"/logout", "/logout/"})
public String logout(Model model, HttpServletRequest request) {
String redirect = request.getRequestURL().toString();
model.addAttribute("cflogout", logoutUrl + "?client_id=app&redirect=" + redirect);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void setTreeUrlPattern(String treeUrlPattern) {
this.treeUrlPattern = treeUrlPattern;
}

@RequestMapping("/apps")
@RequestMapping({"/apps", "/apps/"})
public String apps(Model model, Principal principal) throws Exception {
loadItems(model, "apps");
addUserInfo(model, principal);
Expand Down
4 changes: 2 additions & 2 deletions samples/app/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
you under the Apache License, Version 2.0 (the "License"). You may not use this product except in compliance with the License.
This product includes a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents
is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. -->
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
<web-app xmlns="https://jakarta.ee/xml/ns/jakartaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd" version="6.0">

<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.client.HttpClientErrorException;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.validation.Valid;
import javax.validation.constraints.Email;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import jakarta.validation.Valid;
import jakarta.validation.constraints.Email;
import java.util.List;
import java.util.stream.Collectors;

Expand All @@ -41,7 +41,7 @@ public AccountsController(
this.identityProviderProvisioning = identityProviderProvisioning;
}

@RequestMapping(value = "/create_account", method = GET)
@RequestMapping(value = {"/create_account", "/create_account/"}, method = GET)
public String activationEmail(Model model,
@RequestParam(value = "client_id", required = false) String clientId,
@RequestParam(value = "redirect_uri", required = false) String redirectUri,
Expand All @@ -56,7 +56,7 @@ public String activationEmail(Model model,
return "accounts/new_activation_email";
}

@RequestMapping(value = "/create_account.do", method = POST)
@RequestMapping(value = {"/create_account.do", "/create_account.do/"}, method = POST)
public String sendActivationEmail(Model model, HttpServletResponse response,
@RequestParam(value = "client_id", required = false) String clientId,
@RequestParam(value = "redirect_uri", required = false) String redirectUri,
Expand Down Expand Up @@ -96,18 +96,18 @@ public String sendActivationEmail(Model model, HttpServletResponse response,
return "redirect:accounts/email_sent";
}

@RequestMapping(value = "/accounts/email_sent", method = RequestMethod.GET)
@RequestMapping(value = {"/accounts/email_sent", "/accounts/email_sent/"}, method = RequestMethod.GET)
public String emailSent() {
return "accounts/email_sent";
}

@RequestMapping(value = "/verify_user", method = RequestMethod.HEAD)
@RequestMapping(value = {"/verify_user", "/verify_user/"}, method = RequestMethod.HEAD)
public String verifyUser() {
// Some mail providers initially send a HEAD request to check the validity of the link before redirecting users.
return "redirect:/login";
}

@RequestMapping(value = "/verify_user", method = GET)
@RequestMapping(value = {"/verify_user", "/verify_user/"}, method = GET)
public String verifyUser(Model model,
@RequestParam("code") String code,
HttpServletResponse response, HttpSession session) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import javax.validation.constraints.Email;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import jakarta.validation.constraints.Email;
import java.util.Map;

@Controller
Expand All @@ -40,7 +40,7 @@ public ChangeEmailController(
this.uaaUserDatabase = uaaUserDatabase;
}

@RequestMapping(value = "/change_email", method = RequestMethod.GET)
@RequestMapping(value = {"/change_email", "/change_email/"}, method = RequestMethod.GET)
public String changeEmailPage(Model model, @RequestParam(value = "client_id", required = false) String clientId,
@RequestParam(value = "redirect_uri", required = false) String redirectUri) {
SecurityContext securityContext = SecurityContextHolder.getContext();
Expand All @@ -50,7 +50,7 @@ public String changeEmailPage(Model model, @RequestParam(value = "client_id", re
return "change_email";
}

@RequestMapping(value = "/change_email.do", method = RequestMethod.POST)
@RequestMapping(value = {"/change_email.do", "/change_email.do/"}, method = RequestMethod.POST)
public String changeEmail(Model model, @Valid @ModelAttribute("newEmail") ValidEmail newEmail, BindingResult result,
@RequestParam(required = false, value = "client_id") String clientId,
@RequestParam(required = false, value = "redirect_uri") String redirectUri,
Expand Down Expand Up @@ -86,7 +86,7 @@ public String changeEmail(Model model, @Valid @ModelAttribute("newEmail") ValidE
return "redirect:email_sent?code=email_change";
}

@RequestMapping(value = "/verify_email", method = RequestMethod.GET)
@RequestMapping(value = {"/verify_email", "/verify_email/"}, method = RequestMethod.GET)
public String verifyEmail(Model model, @RequestParam("code") String code, RedirectAttributes redirectAttributes,
HttpServletResponse httpServletResponse, HttpServletRequest request) {
Map<String, String> response;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
Expand All @@ -28,12 +28,12 @@ public ChangePasswordController(final ChangePasswordService changePasswordServic
this.changePasswordService = changePasswordService;
}

@RequestMapping(value = "/change_password", method = GET)
@RequestMapping(value = {"/change_password", "/change_password/"}, method = GET)
public String changePasswordPage() {
return "change_password";
}

@RequestMapping(value = "/change_password.do", method = POST)
@RequestMapping(value = {"/change_password.do", "/change_password.do/"}, method = POST)
public String changePassword(
Model model,
@RequestParam("current_password") String currentPassword,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.springframework.util.StringUtils;
import org.springframework.web.client.HttpClientErrorException;
import org.thymeleaf.context.Context;
import org.thymeleaf.spring5.SpringTemplateEngine;
import org.thymeleaf.spring6.SpringTemplateEngine;

import java.util.*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequest;
import java.net.URISyntaxException;

import static org.springframework.http.HttpStatus.OK;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public PasswordChangeEndpoint(final IdentityZoneManager identityZoneManager,
this.securityContextAccessor = securityContextAccessor;
}

@RequestMapping(value = "/Users/{userId}/password", method = RequestMethod.PUT)
@RequestMapping(value = {"/Users/{userId}/password", "/Users/{userId}/password/"}, method = RequestMethod.PUT)
@ResponseBody
public ActionResult changePassword(@PathVariable String userId, @RequestBody PasswordChangeRequest change) {
String zoneId = identityZoneManager.getCurrentIdentityZoneId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public PasswordResetEndpoint(
this.identityZoneManager = identityZoneManager;
}

@RequestMapping(value = "/password_resets", method = RequestMethod.POST)
@RequestMapping(value = {"/password_resets", "/password_resets/"}, method = RequestMethod.POST)
public ResponseEntity<PasswordResetResponse> resetPassword(@RequestBody String email,
@RequestParam(required = false, value = "client_id") String clientId,
@RequestParam(required = false, value = "redirect_uri") String redirectUri) {
Expand Down Expand Up @@ -97,7 +97,7 @@ private ExpiringCode getExpiringCode(String code) {
return expiringCode;
}

@RequestMapping(value = "/password_change", method = RequestMethod.POST)
@RequestMapping(value = {"/password_change", "/password_change/"}, method = RequestMethod.POST)
public ResponseEntity<LostPasswordChangeResponse> changePassword(@RequestBody LostPasswordChangeRequest passwordChangeRequest) {
ResponseEntity<LostPasswordChangeResponse> responseEntity;
if (passwordChangeRequest.getChangeCode() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public ProfileController(final ApprovalStore approvalsService,
/**
* Display the current user's approvals
*/
@RequestMapping(value = "/profile", method = RequestMethod.GET)
@RequestMapping(value = {"/profile", "/profile/"}, method = RequestMethod.GET)
public String get(Authentication authentication, Model model) {
Map<String, List<DescribedApproval>> approvals = getCurrentApprovalsForUser(getCurrentUserId());
Map<String, String> clientNames = getClientNames(approvals);
Expand All @@ -70,7 +70,7 @@ public String get(Authentication authentication, Model model) {
/**
* Handle form post for revoking chosen approvals
*/
@RequestMapping(value = "/profile", method = RequestMethod.POST)
@RequestMapping(value = {"/profile", "/profile/"}, method = RequestMethod.POST)
public String post(@RequestParam(required = false) Collection<String> checkedScopes,
@RequestParam(required = false) String update,
@RequestParam(required = false) String delete,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequestWrapper;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
import org.springframework.util.StringUtils;
import org.springframework.web.filter.OncePerRequestFilter;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.Timestamp;

Expand Down
Loading