Format all code.

This commit is contained in:
Kavin 2023-08-05 17:37:42 +01:00
parent 946ac458ed
commit 0eb235180b
No known key found for this signature in database
GPG Key ID: 6E4598CA5C92C41F
3 changed files with 35 additions and 31 deletions

View File

@ -2,8 +2,12 @@ package me.kavin.piped.server;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.nimbusds.oauth2.sdk.*;
import com.nimbusds.oauth2.sdk.auth.ClientAuthentication;
import com.nimbusds.oauth2.sdk.auth.ClientSecretBasic;
import com.nimbusds.oauth2.sdk.id.Identifier;
import com.nimbusds.oauth2.sdk.id.State;
import com.nimbusds.openid.connect.sdk.*;
import com.nimbusds.openid.connect.sdk.claims.UserInfo;
import com.rometools.rome.feed.synd.SyndFeed;
import com.rometools.rome.io.SyndFeedInput;
@ -21,8 +25,8 @@ import me.kavin.piped.server.handlers.auth.AuthPlaylistHandlers;
import me.kavin.piped.server.handlers.auth.FeedHandlers;
import me.kavin.piped.server.handlers.auth.StorageHandlers;
import me.kavin.piped.server.handlers.auth.UserHandlers;
import me.kavin.piped.utils.*;
import me.kavin.piped.utils.ErrorResponse;
import me.kavin.piped.utils.*;
import me.kavin.piped.utils.obj.MatrixHelper;
import me.kavin.piped.utils.obj.OidcProvider;
import me.kavin.piped.utils.obj.federation.FederatedVideoInfo;
@ -35,14 +39,10 @@ import org.jetbrains.annotations.NotNull;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.localization.DateWrapper;
import org.xml.sax.InputSource;
import com.nimbusds.oauth2.sdk.*;
import com.nimbusds.openid.connect.sdk.*;
import com.nimbusds.oauth2.sdk.id.*;
import java.io.ByteArrayInputStream;
import java.net.InetSocketAddress;
import java.net.URI;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
@ -339,9 +339,10 @@ public class ServerLauncher extends MultithreadedHttpServerLauncher {
case "login" -> {
String redirectUri = request.getQueryParameter("redirect");
if (redirectUri == null || redirectUri.equals("")) {
if (StringUtils.isBlank(redirectUri)) {
return HttpResponse.ofCode(400).withHtml("Missing redirect parameter");
}
State state = new State(new Identifier(24) + "." + redirectUri);
Nonce nonce = new Nonce();
@ -674,6 +675,7 @@ public class ServerLauncher extends MultithreadedHttpServerLauncher {
}
return null;
}
private static String[] getArray(String s) {
if (s == null) {

View File

@ -108,6 +108,7 @@ public class UserHandlers {
return null;
}
}
public static String oidcCallbackResponse(String provider, String uid) {
try (Session s = DatabaseSessionFactory.createSession()) {
String dbName = provider + "-" + uid;
@ -134,6 +135,7 @@ public class UserHandlers {
}
}
public static byte[] deleteUserResponse(String session, String pass) throws IOException {
if (StringUtils.isBlank(session))
ExceptionHandler.throwErrorResponse(new InvalidRequestResponse("session is a required parameter"));