-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove /authenticate in favor of custom request cache
- Loading branch information
Showing
5 changed files
with
100 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
- Remove filter in favor of /withings/authenticate endpoint | ||
- Create database for stats | ||
- Sync stats in `/status` | ||
- Create scheduled db backups |
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
88 changes: 88 additions & 0 deletions
88
server/src/main/java/mucsi96/traininglog/core/RedirectToHomeRequestCache.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,88 @@ | ||
package mucsi96.traininglog.core; | ||
|
||
import java.util.Collection; | ||
import java.util.List; | ||
import java.util.Locale; | ||
import java.util.Map; | ||
|
||
import org.springframework.security.web.savedrequest.RequestCache; | ||
import org.springframework.security.web.savedrequest.SavedRequest; | ||
import org.springframework.web.servlet.support.ServletUriComponentsBuilder; | ||
|
||
import jakarta.servlet.http.Cookie; | ||
import jakarta.servlet.http.HttpServletRequest; | ||
import jakarta.servlet.http.HttpServletResponse; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
public class RedirectToHomeRequestCache implements RequestCache { | ||
|
||
@Override | ||
public SavedRequest getRequest(HttpServletRequest request, HttpServletResponse response) { | ||
String redirectUrl = ServletUriComponentsBuilder | ||
.fromCurrentServletMapping() | ||
.build() | ||
.toUri() | ||
.resolve("/") | ||
.toString(); | ||
return new RedirectToHomeSavedRequest(redirectUrl); | ||
} | ||
|
||
@Override | ||
public void saveRequest(HttpServletRequest request, HttpServletResponse response) { | ||
} | ||
|
||
@Override | ||
public HttpServletRequest getMatchingRequest(HttpServletRequest request, HttpServletResponse response) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public void removeRequest(HttpServletRequest request, HttpServletResponse response) { | ||
} | ||
|
||
} | ||
|
||
@RequiredArgsConstructor | ||
class RedirectToHomeSavedRequest implements SavedRequest { | ||
private final String redirectUrl; | ||
|
||
@Override | ||
public String getRedirectUrl() { | ||
return redirectUrl; | ||
} | ||
|
||
@Override | ||
public List<Cookie> getCookies() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public String getMethod() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public List<String> getHeaderValues(String name) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Collection<String> getHeaderNames() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public List<Locale> getLocales() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public String[] getParameterValues(String name) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Map<String, String[]> getParameterMap() { | ||
return null; | ||
} | ||
} |
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