mirror of https://github.com/jgraph/drawio.git
Merge pull request #4905 from krzysztof-cislo/dev
Takes a long time to explain. OK, we'll merge as-is. We don't use this code, so it has no impact on us, anyway.
This commit is contained in:
commit
bc64f18f74
|
@ -10,47 +10,52 @@ abstract public class MSGraphAuth extends AbsAuth
|
||||||
{
|
{
|
||||||
public static String CLIENT_SECRET_FILE_PATH = "msgraph_client_secret";
|
public static String CLIENT_SECRET_FILE_PATH = "msgraph_client_secret";
|
||||||
public static String CLIENT_ID_FILE_PATH = "msgraph_client_id";
|
public static String CLIENT_ID_FILE_PATH = "msgraph_client_id";
|
||||||
|
public static String TENANT_ID_FILE_PATH = "msgraph_tenant_id";
|
||||||
|
|
||||||
private static Config CONFIG = null;
|
private static Config CONFIG = null;
|
||||||
|
|
||||||
protected Config getConfig()
|
protected Config getConfig()
|
||||||
{
|
{
|
||||||
if (CONFIG == null)
|
if (CONFIG == null)
|
||||||
{
|
{
|
||||||
String clientSerets = SecretFacade.getSecret(CLIENT_SECRET_FILE_PATH, getServletContext()),
|
String clientSecrets = SecretFacade.getSecret(CLIENT_SECRET_FILE_PATH, getServletContext()),
|
||||||
clientIds = SecretFacade.getSecret(CLIENT_ID_FILE_PATH, getServletContext());
|
clientId = SecretFacade.getSecret(CLIENT_ID_FILE_PATH, getServletContext()),
|
||||||
|
tenantId = SecretFacade.getSecret(TENANT_ID_FILE_PATH, getServletContext());
|
||||||
CONFIG = new Config(clientIds, clientSerets);
|
|
||||||
CONFIG.REDIRECT_PATH = "/microsoft";
|
|
||||||
CONFIG.AUTH_SERVICE_URL = "https://login.microsoftonline.com/common/oauth2/v2.0/token";
|
|
||||||
}
|
|
||||||
|
|
||||||
return CONFIG;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MSGraphAuth()
|
CONFIG = new Config(clientId, clientSecrets);
|
||||||
|
|
||||||
|
String tenantIdPathPart = (tenantId != null && !tenantId.isEmpty()) ? tenantId : "common";
|
||||||
|
CONFIG.AUTH_SERVICE_URL = "https://login.microsoftonline.com/" + tenantIdPathPart + "/oauth2/v2.0/token";
|
||||||
|
|
||||||
|
CONFIG.REDIRECT_PATH = "/microsoft";
|
||||||
|
}
|
||||||
|
|
||||||
|
return CONFIG;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MSGraphAuth()
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
cookiePath = "/microsoft";
|
cookiePath = "/microsoft";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String processAuthResponse(String authRes, boolean jsonResponse)
|
protected String processAuthResponse(String authRes, boolean jsonResponse)
|
||||||
{
|
{
|
||||||
StringBuffer res = new StringBuffer();
|
StringBuffer res = new StringBuffer();
|
||||||
|
|
||||||
//Call the opener callback function directly with the given json
|
//Call the opener callback function directly with the given json
|
||||||
if (!jsonResponse)
|
if (!jsonResponse)
|
||||||
{
|
{
|
||||||
res.append("<!DOCTYPE html><html><head><script>");
|
res.append("<!DOCTYPE html><html><head><script>");
|
||||||
res.append("(function() { var authInfo = "); //The following is a json containing access_token
|
res.append("(function() { var authInfo = "); //The following is a json containing access_token
|
||||||
}
|
}
|
||||||
|
|
||||||
res.append(authRes);
|
res.append(authRes);
|
||||||
|
|
||||||
if (!jsonResponse)
|
if (!jsonResponse)
|
||||||
{
|
{
|
||||||
res.append(";");
|
res.append(";");
|
||||||
res.append("if (window.opener != null && window.opener.onOneDriveCallback != null)");
|
res.append("if (window.opener != null && window.opener.onOneDriveCallback != null)");
|
||||||
res.append("{");
|
res.append("{");
|
||||||
res.append(" window.opener.onOneDriveCallback(authInfo, window);");
|
res.append(" window.opener.onOneDriveCallback(authInfo, window);");
|
||||||
res.append("} else {");
|
res.append("} else {");
|
||||||
|
|
Loading…
Reference in New Issue