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

feat: hydra integration for auth, token and few more endpoints #1032

Merged
merged 40 commits into from
Sep 25, 2024
Merged
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
8438685
fix: auth and token api
sattvikc Aug 20, 2024
48cfb7a
fix: cookie and code transformations
sattvikc Aug 21, 2024
fa44c0c
fix: token re-signing
sattvikc Aug 23, 2024
cb79064
fix: token endpoint
sattvikc Aug 26, 2024
393146b
fix: license check and jwks caching
sattvikc Aug 26, 2024
824cbbd
fix: exceptions
sattvikc Aug 27, 2024
cf408d4
fix: refactor
sattvikc Aug 27, 2024
802bbd3
fix: refactor
sattvikc Aug 28, 2024
7839b69
fix: refactor and client crud APIs
sattvikc Aug 29, 2024
8eb8dc2
fix: token type enum
sattvikc Sep 3, 2024
b9b2d68
fix: process ext only on access token
sattvikc Sep 3, 2024
04e7c76
fix: refactor
sattvikc Sep 4, 2024
874ac8c
fix: bugs and refactor
sattvikc Sep 5, 2024
2721620
fix: oauth clients list api
sattvikc Sep 5, 2024
6f03959
fix: consent get accept and reject
sattvikc Sep 5, 2024
41836b3
fix: login request
sattvikc Sep 6, 2024
3a10264
fix: query param transformation
sattvikc Sep 6, 2024
1eddb69
fix: logout request
sattvikc Sep 9, 2024
84fda3f
fix: refactor
sattvikc Sep 9, 2024
7f413c6
fix: remove error debug and hint
sattvikc Sep 9, 2024
c620cdf
fix: introspect api
sattvikc Sep 10, 2024
3e94443
fix: pr comments
sattvikc Sep 11, 2024
b79ddfa
fix: pr comments
sattvikc Sep 11, 2024
ca95c13
fix: pr comment
sattvikc Sep 11, 2024
621befb
fix: pr comment
sattvikc Sep 11, 2024
12c09a0
fix: pr comments and refactor
sattvikc Sep 12, 2024
b6ab81b
fix: pr comments
sattvikc Sep 12, 2024
d87769a
fix: pr comments
sattvikc Sep 12, 2024
085e5c1
fix: revert original http request
sattvikc Sep 12, 2024
bdcdc29
fix: pr comment refactor
sattvikc Sep 12, 2024
d8a1b87
fix: pr comment
sattvikc Sep 16, 2024
360b266
fix: pr comment
sattvikc Sep 16, 2024
f3c022f
fix: pr comment
sattvikc Sep 18, 2024
095a27f
fix: pr comments
sattvikc Sep 18, 2024
da96bc4
fix: owner and pagination
sattvikc Sep 18, 2024
160dce5
fix: pr comment
sattvikc Sep 18, 2024
bd0a918
fix: client id check
sattvikc Sep 18, 2024
b791bf4
fix: ext related
sattvikc Sep 18, 2024
c568f5c
fix: pr comment
sattvikc Sep 19, 2024
bd86375
fix: revoke APIs (#1041)
sattvikc Sep 25, 2024
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
Prev Previous commit
Next Next commit
fix: login request
sattvikc committed Sep 6, 2024
commit 41836b338f64e339a324f51d39ea395179baa4f1
6 changes: 6 additions & 0 deletions src/main/java/io/supertokens/webserver/Webserver.java
Original file line number Diff line number Diff line change
@@ -42,9 +42,12 @@
import io.supertokens.webserver.api.oauth.OAuthAuthAPI;
import io.supertokens.webserver.api.oauth.OAuthClientListAPI;
import io.supertokens.webserver.api.oauth.OAuthGetAuthConsentRequestAPI;
import io.supertokens.webserver.api.oauth.OAuthGetAuthLoginRequestAPI;
import io.supertokens.webserver.api.oauth.OAuthRejectAuthConsentRequestAPI;
import io.supertokens.webserver.api.oauth.OAuthRejectAuthLoginRequestAPI;
import io.supertokens.webserver.api.oauth.CreateUpdateOrGetOAuthClientAPI;
import io.supertokens.webserver.api.oauth.OAuthAcceptAuthConsentRequestAPI;
import io.supertokens.webserver.api.oauth.OAuthAcceptAuthLoginRequestAPI;
import io.supertokens.webserver.api.oauth.OAuthTokenAPI;
import io.supertokens.webserver.api.oauth.RemoveOAuthClientAPI;
import io.supertokens.webserver.api.passwordless.*;
@@ -284,6 +287,9 @@ private void setupRoutes() {
addAPI(new OAuthGetAuthConsentRequestAPI(main));
addAPI(new OAuthAcceptAuthConsentRequestAPI(main));
addAPI(new OAuthRejectAuthConsentRequestAPI(main));
addAPI(new OAuthGetAuthLoginRequestAPI(main));
addAPI(new OAuthAcceptAuthLoginRequestAPI(main));
addAPI(new OAuthRejectAuthLoginRequestAPI(main));

StandardContext context = tomcatReference.getContext();
Tomcat tomcat = tomcatReference.getTomcat();
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package io.supertokens.webserver.api.oauth;

import java.io.IOException;
import java.util.List;
import java.util.Map;

import com.google.gson.JsonElement;
import com.google.gson.JsonObject;

import io.supertokens.Main;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

public class OAuthAcceptAuthLoginRequestAPI extends OAuthProxyBase {

public OAuthAcceptAuthLoginRequestAPI(Main main) {
super(main);
}

@Override
public String getPath() {
return "/recipe/oauth/auth/requests/login/accept";
}

@Override
public ProxyProps[] getProxyProperties(HttpServletRequest req, JsonObject input) {
return new ProxyProps[] {
new ProxyProps(
"PUT", // apiMethod
"PUT_JSON", // method
"/admin/oauth2/auth/requests/login/accept", // path
true, // proxyToAdmin
true // camelToSnakeCaseConversion
)
};
}

@Override
protected void handleResponseFromProxyPUT(HttpServletRequest req, HttpServletResponse resp, JsonObject input, int statusCode, Map<String, List<String>> headers, String rawBody, JsonElement jsonBody) throws IOException, ServletException {
JsonObject response = jsonBody.getAsJsonObject();
response.addProperty("status", "OK");
sendJsonResponse(200, response, resp);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package io.supertokens.webserver.api.oauth;

import java.io.IOException;
import java.util.List;
import java.util.Map;

import com.google.gson.JsonElement;
import com.google.gson.JsonObject;

import io.supertokens.Main;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

public class OAuthGetAuthLoginRequestAPI extends OAuthProxyBase {

public OAuthGetAuthLoginRequestAPI(Main main) {
super(main);
}

@Override
public String getPath() {
return "/recipe/oauth/auth/requests/login";
}

@Override
public ProxyProps[] getProxyProperties(HttpServletRequest req, JsonObject input) {
return new ProxyProps[] {
new ProxyProps(
"GET", // apiMethod
"GET", // method
"/admin/oauth2/auth/requests/login", // path
true, // proxyToAdmin
true // camelToSnakeCaseConversion
)
};
}

@Override
protected void handleResponseFromProxyGET(HttpServletRequest req, HttpServletResponse resp, int statusCode,
Map<String, List<String>> headers, String rawBody, JsonElement jsonBody)
throws IOException, ServletException {

JsonObject response = jsonBody.getAsJsonObject();
response.addProperty("status", "OK");
sendJsonResponse(200, response, resp);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package io.supertokens.webserver.api.oauth;

import java.io.IOException;
import java.util.List;
import java.util.Map;

import com.google.gson.JsonElement;
import com.google.gson.JsonObject;

import io.supertokens.Main;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

public class OAuthRejectAuthLoginRequestAPI extends OAuthProxyBase {

public OAuthRejectAuthLoginRequestAPI(Main main) {
super(main);
}

@Override
public String getPath() {
return "/recipe/oauth/auth/requests/login/reject";
}

@Override
public ProxyProps[] getProxyProperties(HttpServletRequest req, JsonObject input) {
return new ProxyProps[] {
new ProxyProps(
"PUT", // apiMethod
"PUT_JSON", // method
"/admin/oauth2/auth/requests/login/reject", // path
true, // proxyToAdmin
true // camelToSnakeCaseConversion
)
};
}

@Override
protected void handleResponseFromProxyPUT(HttpServletRequest req, HttpServletResponse resp, JsonObject input, int statusCode, Map<String, List<String>> headers, String rawBody, JsonElement jsonBody) throws IOException, ServletException {
JsonObject response = jsonBody.getAsJsonObject();
response.addProperty("status", "OK");
sendJsonResponse(200, response, resp);
}
}