NIHVIVO-2279 On external auth, the HTTP header holds the externalAuthId -- there is no username any more.
This commit is contained in:
parent
f3ca1a71a3
commit
cab3bfe9b1
3 changed files with 11 additions and 11 deletions
|
@ -34,8 +34,8 @@ public class ExternalAuthHelper {
|
||||||
/** This configuration property points to the external authorization server. */
|
/** This configuration property points to the external authorization server. */
|
||||||
private static final String PROPERTY_EXTERNAL_AUTH_SERVER_URL = "externalAuth.serverUrl";
|
private static final String PROPERTY_EXTERNAL_AUTH_SERVER_URL = "externalAuth.serverUrl";
|
||||||
|
|
||||||
/** This configuration property says which HTTP header holds the username. */
|
/** This configuration property says which HTTP header holds the auth ID. */
|
||||||
public static final String PROPERTY_EXTERNAL_AUTH_USERNAME_HEADER = "externalAuth.netIdHeaderName";
|
public static final String PROPERTY_EXTERNAL_AUTH_ID_HEADER = "externalAuth.netIdHeaderName";
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// static methods
|
// static methods
|
||||||
|
@ -82,7 +82,7 @@ public class ExternalAuthHelper {
|
||||||
String externalAuthServerUrl = ConfigurationProperties.getBean(ctx)
|
String externalAuthServerUrl = ConfigurationProperties.getBean(ctx)
|
||||||
.getProperty(PROPERTY_EXTERNAL_AUTH_SERVER_URL);
|
.getProperty(PROPERTY_EXTERNAL_AUTH_SERVER_URL);
|
||||||
String externalAuthHeaderName = ConfigurationProperties.getBean(ctx)
|
String externalAuthHeaderName = ConfigurationProperties.getBean(ctx)
|
||||||
.getProperty(PROPERTY_EXTERNAL_AUTH_USERNAME_HEADER);
|
.getProperty(PROPERTY_EXTERNAL_AUTH_ID_HEADER);
|
||||||
|
|
||||||
return new ExternalAuthHelper(externalAuthServerUrl,
|
return new ExternalAuthHelper(externalAuthServerUrl,
|
||||||
externalAuthHeaderName);
|
externalAuthHeaderName);
|
||||||
|
@ -134,7 +134,7 @@ public class ExternalAuthHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getExternalUsername(HttpServletRequest request) {
|
public String getExternalAuthId(HttpServletRequest request) {
|
||||||
if (request == null) {
|
if (request == null) {
|
||||||
log.error("request is null.");
|
log.error("request is null.");
|
||||||
return null;
|
return null;
|
||||||
|
@ -143,13 +143,13 @@ public class ExternalAuthHelper {
|
||||||
if (externalAuthHeaderName == null) {
|
if (externalAuthHeaderName == null) {
|
||||||
log.error("User asked for external authentication, "
|
log.error("User asked for external authentication, "
|
||||||
+ "but deploy.properties doesn't contain a value for '"
|
+ "but deploy.properties doesn't contain a value for '"
|
||||||
+ PROPERTY_EXTERNAL_AUTH_USERNAME_HEADER + "'");
|
+ PROPERTY_EXTERNAL_AUTH_ID_HEADER + "'");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
String username = request.getHeader(externalAuthHeaderName);
|
String externalAuthId = request.getHeader(externalAuthHeaderName);
|
||||||
log.debug("username=" + username);
|
log.debug("externalAuthId=" + externalAuthId);
|
||||||
return username;
|
return externalAuthId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -117,7 +117,7 @@ public class FakeExternalAuthController extends FreemarkerHttpServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getExternalUsername(HttpServletRequest request) {
|
public String getExternalAuthId(HttpServletRequest request) {
|
||||||
log.debug("external username is '" + username + "'");
|
log.debug("external username is '" + username + "'");
|
||||||
return username;
|
return username;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,8 +40,8 @@ public class LoginExternalAuthReturn extends BaseLoginServlet {
|
||||||
@Override
|
@Override
|
||||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
|
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
|
||||||
throws ServletException, IOException {
|
throws ServletException, IOException {
|
||||||
String username = ExternalAuthHelper.getHelper(req)
|
String username = ExternalAuthHelper.getHelper(req).getExternalAuthId(
|
||||||
.getExternalUsername(req);
|
req);
|
||||||
List<String> associatedUris = getAuthenticator(req)
|
List<String> associatedUris = getAuthenticator(req)
|
||||||
.getAssociatedIndividualUris(username);
|
.getAssociatedIndividualUris(username);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue