Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
4d341de
Changes for Tomcat 8
ryanrdoherty Apr 1, 2022
3a7452f
Merge branch 'master' into tomcat8
ryanrdoherty Apr 26, 2022
0fa1564
Merge branch 'master' into tomcat9
ryanrdoherty Jun 11, 2024
0785869
Merge branch 'master' into j21tc9
ryanrdoherty Jun 13, 2024
c9631b6
Always use https for redirect URLs
ryanrdoherty Jun 28, 2024
41555ba
Add external OAuth URL option so we can use docker network URLs for d…
ryanrdoherty Jul 2, 2024
2074d7d
Fix bug
ryanrdoherty Jul 4, 2024
ef3cfb3
Make sure redirects use https
ryanrdoherty Jul 4, 2024
fd78688
Merge branch 'master' into j21tc9
ryanrdoherty Jul 9, 2024
8984a4a
Try to make sure redirects use https
ryanrdoherty Jul 10, 2024
cdde209
Merge branch 'j21tc9' of github.com:VEuPathDB/WDK into j21tc9
ryanrdoherty Jul 10, 2024
22f974c
Merge branch 'master' into j21tc9
ryanrdoherty Aug 5, 2024
f413d5a
Merge branch 'master' into j21tc9
ryanrdoherty Aug 6, 2024
b197a24
Merge branch 'master' into j21tc9
ryanrdoherty Aug 12, 2024
96f454a
Merge branch 'master' into j21tc9
ryanrdoherty Aug 12, 2024
8f29683
Merge branch 'master' into j21tc9
dmgaldi Aug 13, 2024
b71016e
Merge branch 'j21tc9' of github.com:VEuPathDB/WDK into j21tc9
ryanrdoherty Aug 14, 2024
0f0d09e
Postgres support (#100)
dmgaldi Aug 14, 2024
4b1abe9
Add back deleted file and remove postgres dep (driver lives in tomcat…
ryanrdoherty Aug 14, 2024
74e14fc
Merge branch 'master' into j21tc9
ryanrdoherty Aug 15, 2024
80d101e
Fix date postgres and make SMTP port configurable (#102)
dmgaldi Aug 16, 2024
170e524
Merge branch 'master' into j21tc9
ryanrdoherty Aug 21, 2024
7494aed
Add explicit stack trace dump to debut import issue
ryanrdoherty Sep 11, 2024
6919d54
Merge branch 'master' into j21tc9
ryanrdoherty Sep 11, 2024
c10ffa2
Merge branch 'j21tc9' of github.com:VEuPathDB/WDK into j21tc9
ryanrdoherty Sep 12, 2024
2b7f6df
Merge branch 'master' into j21tc9
ryanrdoherty Sep 13, 2024
5d3ab30
Merge branch 'master' into j21tc9
ryanrdoherty Sep 13, 2024
74f0711
Merge branch 'master' into j21tc9
ryanrdoherty Sep 19, 2024
19f1368
Merge branch 'j21tc9' of github.com:VEuPathDB/WDK into j21tc9
ryanrdoherty Jan 6, 2025
c398d98
Merge branch 'master' into j21tc9
ryanrdoherty Jan 6, 2025
56e85d9
Deprecate override of deprecated method
ryanrdoherty Jan 7, 2025
dde0eff
Change 500 -> 400 if data param is missing
ryanrdoherty Jan 10, 2025
b88dc4d
Add better error logging to be more accurate and show underlying erro…
ryanrdoherty Jan 10, 2025
732616b
Merge branch 'master' into j21tc9
ryanrdoherty Jan 14, 2025
599b9a0
Improve error message if display column is null
ryanrdoherty Jan 22, 2025
803fb09
Merge branch 'master' into j21tc9
ryanrdoherty Jan 22, 2025
682b50a
Merge branch 'master' into j21tc9
Foxcapades Feb 26, 2025
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 @@ -14,7 +14,7 @@ site_vars file: {{ site_vars }}
docBase="{{ contextxml_docBase }}"
privileged="{{ contextxml_privileged|default("false") }}"
swallowOutput="{{ contextxml_swallowOutput|default("true") }}"
allowLinking="{{ contextxml_allowLinking|default("true") }}"
>
<Resources allowLinking="{{ contextxml_allowLinking|default("true") }}" />
<Parameter name="model" value="{{ contextxml_model }}"/>
</Context>
3 changes: 3 additions & 0 deletions Model/lib/rng/wdkModel-config.rng
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@
<optional>
<attribute name="oauthUrl"/>
</optional>
<optional>
<attribute name="externalOauthUrl"/>
</optional>
<optional>
<attribute name="oauthClientId"/>
</optional>
Expand Down
2 changes: 1 addition & 1 deletion Model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ public void setStatus(int sc) {
super.setStatus(sc);
}

@Deprecated
@Override
public void setStatus(int sc, String sm) {
_responseStatus = sc;
Expand Down
12 changes: 11 additions & 1 deletion Model/src/main/java/org/gusdb/wdk/model/config/ModelConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ public String getName() {
*/
private final AuthenticationMethod _authenticationMethod;
private final String _oauthUrl; // needed if method is OAUTH2
private final String _externalOauthUrl; // may be needed if method is OAUTH2 and internal URL is not available externally
private final String _oauthClientId; // needed if method is OAUTH2
private final String _oauthClientSecret; // needed if method is OAUTH2
private final String _changePasswordUrl; // probably needed if method is OAUTH2
Expand All @@ -170,7 +171,7 @@ public ModelConfig(String modelName, String projectId, Path gusHome, boolean cac
List<String> adminEmails, String emailSubject, String emailContent, ModelConfigUserDB userDB, ModelConfigAppDB appDB,
ModelConfigUserDatasetStore userDatasetStoreConfig, QueryMonitor queryMonitor,
boolean monitorBlockedThreads, int blockedThreshold, AuthenticationMethod authenticationMethod,
String oauthUrl, String oauthClientId, String oauthClientSecret, String changePasswordUrl,
String oauthUrl, String externalOauthUrl, String oauthClientId, String oauthClientSecret, String changePasswordUrl,
String keyStoreFile, String keyStorePassPhrase) {

// basic model information
Expand Down Expand Up @@ -221,6 +222,7 @@ public ModelConfig(String modelName, String projectId, Path gusHome, boolean cac
// user authentication setup
_authenticationMethod = authenticationMethod;
_oauthUrl = oauthUrl;
_externalOauthUrl = externalOauthUrl;
_oauthClientId = oauthClientId;
_oauthClientSecret = oauthClientSecret;
_changePasswordUrl = changePasswordUrl;
Expand Down Expand Up @@ -382,6 +384,14 @@ public String getOauthUrl() {
return _oauthUrl;
}

/**
* @return base URL of OAuth2 server to use for authentication
* (called only if authentication method is OAUTH2)
*/
public String getExternalOauthUrl() {
return _externalOauthUrl != null && !_externalOauthUrl.isBlank() ? _externalOauthUrl : _oauthUrl;
}

/**
* @return OAuth2 client ID to use for authentication
* (called only if authentication method is OAUTH2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public class ModelConfigBuilder {
// user authentication setup
private AuthenticationMethod _authenticationMethod = AuthenticationMethod.USER_DB;
private String _oauthUrl = ""; // needed if method is OAUTH2
private String _externalOauthUrl = null; // may be needed if method is OAUTH2 and internal URL is not available externally
private String _oauthClientId = ""; // needed if method is OAUTH2
private String _oauthClientSecret = ""; // needed if method is OAUTH2
private String _changePasswordUrl = ""; // probably needed if method is OAUTH2
Expand Down Expand Up @@ -152,6 +153,7 @@ public ModelConfig build() throws WdkModelException {
// user authentication setup
_authenticationMethod,
_oauthUrl,
_externalOauthUrl,
_oauthClientId,
_oauthClientSecret,
_changePasswordUrl,
Expand Down Expand Up @@ -308,6 +310,17 @@ public void setOauthUrl(String oauthUrl) {
_oauthUrl = oauthUrl;
}

/**
* @param externalOauthUrl base URL of OAuth2 server to use for authentication
* (used only if authentication method is OAUTH2). This may differ from the
* (internal) oauthUrl for some deployments. The external value is returned to
* external clients, telling them how to connect to OAuth. The internal value
* is what WDK actually uses to connect directly to OAuth.
*/
public void setExternalOauthUrl(String externalOauthUrl) {
_externalOauthUrl = externalOauthUrl;
}

/**
* @param oauthClientId OAuth2 client ID to use for authentication
* (used only if authentication method is OAUTH2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class UserReferenceFactory {
// SQL and types to select user ref by ID
private static final String SELECT_USER_REF_BY_ID_SQL =
"select " + COL_USER_ID + ", " + COL_IS_GUEST + ", " + COL_FIRST_ACCESS +
" from " + USER_SCHEMA_MACRO + TABLE_USERS +
" where " + COL_USER_ID + " = ?";
" from " + USER_SCHEMA_MACRO + TABLE_USERS +
" where " + COL_USER_ID + " = ?";

private static final Integer[] SELECT_USER_REF_BY_ID_PARAM_TYPES = { Types.BIGINT };

Expand Down Expand Up @@ -67,7 +67,7 @@ public UserReferenceFactory(WdkModel wdkModel) {
* changed by this code.
*
* @param user user to add
* @throws WdkModelException
* @throws WdkModelException
*/
public int addUserReference(UserInfo user) throws WdkModelException {
try {
Expand Down Expand Up @@ -104,8 +104,8 @@ public Optional<UserReference> getUserReference(long userId) throws WdkModelExce
SELECT_USER_REF_BY_ID_PARAM_TYPES,
rs ->
!rs.next()
? Optional.empty()
: Optional.of(new UserReference(
? Optional.empty()
: Optional.of(new UserReference(
rs.getLong(COL_USER_ID),
rs.getBoolean(COL_IS_GUEST),
new Date(rs.getTimestamp(COL_FIRST_ACCESS).getTime()))));
Expand Down
2 changes: 1 addition & 1 deletion Service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ public static JSONObject getWdkProjectInfo(WdkModel wdkModel, String serviceEndp
// create authentication config sub-object
JSONObject authConfig = new JSONObject()
.put(JsonKeys.AUTHENTICATION_METHOD, config.getAuthenticationMethodEnum().name())
.put(JsonKeys.OAUTH_URL, config.getOauthUrl())
.put(JsonKeys.OAUTH_CLIENT_URL, serviceEndpoint)
// Tell client to use external URL
.put(JsonKeys.OAUTH_URL, config.getExternalOauthUrl())
// Always use HTTPS
.put(JsonKeys.OAUTH_CLIENT_URL, serviceEndpoint.replace("http://","https://"))
.put(JsonKeys.OAUTH_CLIENT_ID, config.getOauthClientId());

// create profile property config sub-array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,12 @@ public Response processLogout() throws WdkModelException {
User oldUser = getRequestingUser();
getTemporaryUserData().invalidate();

// build context URI that always uses https
String contextUri = getRequest().getNoContextUri().replace("http://", "https://");

// if user is already a guest, no need to log out
if (oldUser.isGuest())
return createRedirectResponse(getContextUri()).build();
return createRedirectResponse(contextUri).build();

// get a new session and add new guest user to it
TwoTuple<ValidatedToken, User> newUser = getWdkModel().getUserFactory().createUnregisteredUser();
Expand All @@ -299,7 +302,7 @@ public Response processLogout() throws WdkModelException {
logoutCookies.add(extraCookie);
}

ResponseBuilder builder = createRedirectResponse(getContextUri());
ResponseBuilder builder = createRedirectResponse(contextUri);
for (CookieBuilder logoutCookie : logoutCookies) {
builder.cookie(logoutCookie.toJaxRsCookie());
}
Expand Down Expand Up @@ -342,7 +345,7 @@ private static ResponseBuilder createJsonResponse(boolean success, String messag
*/
private static ResponseBuilder createRedirectResponse(String redirectUrl) throws WdkModelException {
try {
return Response.temporaryRedirect(new URI(redirectUrl));
return Response.temporaryRedirect(new URI(redirectUrl.replace("http://","https://")));
}
catch (URISyntaxException e) {
throw new WdkModelException("Redirect " + redirectUrl + " not a valid URI.");
Expand Down