mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 05:01:07 +00:00
Merge branch 'dev' of github.com:Kingsrook/qqq into dev
This commit is contained in:
2
pom.xml
2
pom.xml
@ -43,7 +43,7 @@
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<revision>0.10.0-SNAPSHOT</revision>
|
||||
<revision>0.11.0-SNAPSHOT</revision>
|
||||
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
|
@ -292,7 +292,9 @@ public class QJavalinImplementation
|
||||
get("/count", QJavalinImplementation::dataCount);
|
||||
post("/count", QJavalinImplementation::dataCount);
|
||||
get("/export", QJavalinImplementation::dataExportWithoutFilename);
|
||||
post("/export", QJavalinImplementation::dataExportWithoutFilename);
|
||||
get("/export/{filename}", QJavalinImplementation::dataExportWithFilename);
|
||||
post("/export/{filename}", QJavalinImplementation::dataExportWithFilename);
|
||||
get("/possibleValues/{fieldName}", QJavalinImplementation::possibleValues);
|
||||
|
||||
// todo - add put and/or patch at this level (without a primaryKey) to do a bulk update based on primaryKeys in the records.
|
||||
@ -357,27 +359,20 @@ public class QJavalinImplementation
|
||||
// either with a "Basic " prefix (for a username:password pair) //
|
||||
// or with a "Bearer " prefix (for a token that can be handled the same as a sessionId cookie) //
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
String basicPrefix = "Basic ";
|
||||
String bearerPrefix = "Bearer ";
|
||||
if(authorizationHeaderValue.startsWith(basicPrefix))
|
||||
{
|
||||
authorizationHeaderValue = authorizationHeaderValue.replaceFirst(basicPrefix, "");
|
||||
authenticationContext.put(BASIC_AUTH_NAME, authorizationHeaderValue);
|
||||
}
|
||||
else if(authorizationHeaderValue.startsWith(bearerPrefix))
|
||||
{
|
||||
authorizationHeaderValue = authorizationHeaderValue.replaceFirst(bearerPrefix, "");
|
||||
authenticationContext.put(SESSION_ID_COOKIE_NAME, authorizationHeaderValue);
|
||||
processAuthorizationValue(authenticationContext, authorizationHeaderValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG.debug("Authorization header value did not have Basic or Bearer prefix. [" + authorizationHeaderValue + "]");
|
||||
}
|
||||
String authorizationFormValue = context.formParam("Authorization");
|
||||
if(StringUtils.hasContent(authorizationFormValue))
|
||||
{
|
||||
processAuthorizationValue(authenticationContext, authorizationFormValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG.debug("Neither [" + SESSION_ID_COOKIE_NAME + "] cookie nor [Authorization] header was present in request.");
|
||||
}
|
||||
}
|
||||
|
||||
QSession session = authenticationModule.createSession(qInstance, authenticationContext);
|
||||
input.setSession(session);
|
||||
@ -408,6 +403,31 @@ public class QJavalinImplementation
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
private static void processAuthorizationValue(Map<String, String> authenticationContext, String authorizationHeaderValue)
|
||||
{
|
||||
String basicPrefix = "Basic ";
|
||||
String bearerPrefix = "Bearer ";
|
||||
if(authorizationHeaderValue.startsWith(basicPrefix))
|
||||
{
|
||||
authorizationHeaderValue = authorizationHeaderValue.replaceFirst(basicPrefix, "");
|
||||
authenticationContext.put(BASIC_AUTH_NAME, authorizationHeaderValue);
|
||||
}
|
||||
else if(authorizationHeaderValue.startsWith(bearerPrefix))
|
||||
{
|
||||
authorizationHeaderValue = authorizationHeaderValue.replaceFirst(bearerPrefix, "");
|
||||
authenticationContext.put(SESSION_ID_COOKIE_NAME, authorizationHeaderValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG.debug("Authorization value did not have Basic or Bearer prefix. [" + authorizationHeaderValue + "]");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
|
Reference in New Issue
Block a user