Skip to content

Commit 170cc36

Browse files
committed
Merge remote-tracking branch 'origin/develop' into fb_redirectGH1023
2 parents 55269b9 + 0ffe5bb commit 170cc36

22 files changed

Lines changed: 664 additions & 201 deletions

File tree

api/src/org/labkey/api/ApiModule.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ public void registerServlets(ServletContext servletCtx)
389389
ApiXmlWriter.TestCase.class,
390390
ArrayListMap.TestCase.class,
391391
AssayResultsFileWriter.TestCase.class,
392+
AuthenticationManager.ReauthTokenTest.class,
392393
BaseServerProperties.TestCase.class,
393394
BooleanFormat.TestCase.class,
394395
BuilderObjectFactory.TestCase.class,

api/src/org/labkey/api/action/SimpleErrorView.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323

2424
/**
2525
* View that renders an error collection.
26-
* User: adam
27-
* Date: Sep 26, 2007
2826
*/
2927
public class SimpleErrorView extends JspView<Boolean>
3028
{

api/src/org/labkey/api/action/SpringActionController.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -267,14 +267,6 @@ protected static <P extends UrlProvider> P urlProvider(Class<P> inter)
267267
return PageFlowUtil.urlProvider(inter);
268268
}
269269

270-
protected void requiresLogin()
271-
{
272-
if (getUser().isGuest())
273-
{
274-
throw new UnauthorizedException();
275-
}
276-
}
277-
278270
protected ViewBackgroundInfo getViewBackgroundInfo()
279271
{
280272
ViewContext vc = getViewContext();

api/src/org/labkey/api/security/AuthenticationConfiguration.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ interface SSOAuthenticationConfiguration<AP extends SSOAuthenticationProvider<?>
114114
{
115115
LinkFactory getLinkFactory();
116116
URLHelper getUrl(ViewContext ctx);
117+
URLHelper getReauthUrl(ViewContext ctx);
117118

118119
/**
119120
* Allows an SSO auth configuration to specify that it should be used automatically instead of showing the standard

api/src/org/labkey/api/security/AuthenticationManager.java

Lines changed: 233 additions & 11 deletions
Large diffs are not rendered by default.

api/src/org/labkey/api/security/AuthenticationProvider.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ class AuthenticationResponse
307307
private @NotNull Map<String, String> _userAttributeMap = Collections.emptyMap(); // A case-insensitive map of attribute names and values associated with the user
308308
private @NotNull Map<String, Object> _authenticationProperties = Collections.emptyMap();
309309
private boolean _requireSecondary = true; // Require secondary authentication
310+
private boolean _reauth = false;
310311
private @Nullable String _successDetails = null; // An optional string describing how successful authentication took place, which will
311312
// appear in the audit log. If null, the configuration's description will be used.
312313

@@ -447,6 +448,17 @@ public AuthenticationResponse setRequireSecondary(boolean requireSecondary)
447448
_requireSecondary = requireSecondary;
448449
return this;
449450
}
451+
452+
public boolean isReauth()
453+
{
454+
return _reauth;
455+
}
456+
457+
public AuthenticationResponse setReauth(boolean reauth)
458+
{
459+
_reauth = reauth;
460+
return this;
461+
}
450462
}
451463

452464
// FailureReasons are only reported to administrators (in the audit log and/or server log), NOT to users (and potential

api/src/org/labkey/api/security/LoginUrls.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ public interface LoginUrls extends UrlProvider
3535
ActionURL getLoginURL(URLHelper returnUrl);
3636
ActionURL getRegisterURL(Container c, @Nullable URLHelper returnUrl);
3737
ActionURL getLoginURL(Container c, @Nullable URLHelper returnUrl);
38-
ActionURL getForceReauthURL(Container c, @Nullable URLHelper returnUrl);
38+
ActionURL getForceReauthURL(Container c, boolean local, @Nullable URLHelper returnUrl);
3939
ActionURL getLogoutURL(Container c);
4040
ActionURL getLogoutURL(Container c, URLHelper returnUrl);
4141
ActionURL getStopImpersonatingURL(Container c, @Nullable URLHelper returnUrl);
4242
ActionURL getAgreeToTermsURL(Container c, URLHelper returnUrl);
4343
ActionURL getSSORedirectURL(SSOAuthenticationConfiguration<?> configuration, URLHelper returnUrl, boolean skipProfile);
44+
ActionURL getSSOReauthURL(SSOAuthenticationConfiguration<?> configuration, URLHelper returnUrl);
4445
}

core/resources/views/login.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<form class="auth-form" name="login" method="post">
2-
<div class="auth-header">Sign In</div>
2+
<div class="auth-header" id="header">Sign In</div>
33
<div class="labkey-error" id="errors"></div>
44
<div class="auth-form-body">
55
<label for="email">Email</label>
@@ -23,7 +23,7 @@
2323
<div class="auth-item auth-credentials-submit">
2424
<!-- Note: login.js attaches an authenticateUser() click event to elements with classes "loginSubmitButton" and "signin-btn" -->
2525
<input type="submit" tabindex="-1" class="loginSubmitButton"/>
26-
<button class="labkey-button primary signin-btn" type="button"><span>Sign In</span></button>
26+
<button class="labkey-button primary signin-btn" type="button"><span id="sign-in-button">Sign In</span></button>
2727
<span class="registrationSection" hidden>
2828
<a class="labkey-button" id="registerButton" href="login-register.view">Register</a>
2929
</span>

core/src/client/ErrorHandler/ErrorHandler.test.tsx

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
*/
66
import React from 'react';
77
import { userEvent } from '@testing-library/user-event';
8-
import { renderWithAppContext } from '@labkey/components'
9-
import { getServerContext } from '@labkey/api';
8+
import { renderWithAppContext } from '@labkey/components';
109

1110
import { ErrorHandlerImpl } from './ErrorHandler';
1211
import { ErrorDetails, ErrorType } from './model';
@@ -19,28 +18,33 @@ describe('ErrorHandlerImpl', () => {
1918
message: 'This is a not found exception',
2019
};
2120
renderWithAppContext(<ErrorHandlerImpl context={{ errorDetails }} />);
22-
expect(document.querySelector('.labkey-error-heading').innerHTML.includes(errorDetails.message)).toBeTruthy();
21+
expect(document.querySelector('.labkey-error-heading').textContent.includes(errorDetails.message)).toBeTruthy();
2322
expect(document.querySelectorAll('.error-details-container')).toHaveLength(0);
2423

2524
await userEvent.click(document.querySelectorAll('.error-page-button')[2]);
2625
const question = document.querySelector('.error-details-container');
27-
expect(question.innerHTML.includes('What went wrong?')).toBeTruthy();
28-
expect(question.innerHTML.includes('Incorrect URL:')).toBeTruthy();
26+
expect(question.textContent.includes('What went wrong?')).toBeTruthy();
27+
expect(question.textContent.includes('Incorrect URL:')).toBeTruthy();
2928
});
3029

3130
test('Configuration exception', async () => {
3231
const errorDetails: ErrorDetails = {
3332
errorType: ErrorType.configuration,
3433
message: 'This is a configuration exception',
3534
};
36-
const subheading = 'The requested page cannot be found.';
3735
renderWithAppContext(<ErrorHandlerImpl context={{ errorDetails }} />);
38-
expect(document.querySelector('.labkey-error-subheading').innerHTML.includes(subheading)).toBeTruthy();
36+
expect(document.querySelector('.labkey-error-subheading').textContent).toEqual(
37+
'This is a configuration exception.'
38+
);
3939
expect(document.querySelectorAll('.error-details-container')).toHaveLength(0);
4040

4141
await userEvent.click(document.querySelectorAll('.error-page-button')[2]);
42-
expect(document.querySelector('.labkey-error-details-question').innerHTML.includes('What went wrong?')).toBeTruthy();
43-
expect(document.querySelector('div.labkey-error-details').innerHTML.includes('Server Configuration Errors')).toBeTruthy();
42+
expect(
43+
document.querySelector('.labkey-error-details-question').textContent.includes('What went wrong?')
44+
).toBeTruthy();
45+
expect(
46+
document.querySelector('div.labkey-error-details').textContent.includes('Server Configuration Errors')
47+
).toBeTruthy();
4448
});
4549

4650
test('Permission exception', async () => {
@@ -56,14 +60,19 @@ describe('ErrorHandlerImpl', () => {
5660
serverContext: {
5761
impersonatingUser: { displayName: impersonatedUser },
5862
user: { displayName: realUser, isSignedIn: true } as any,
59-
}
63+
},
6064
});
61-
expect(document.querySelector('.labkey-error-subheading').innerHTML.includes(errorDetails.message)).toBeTruthy();
65+
expect(
66+
document.querySelector('.labkey-error-subheading').textContent.includes(errorDetails.message)
67+
).toBeTruthy();
6268
expect(document.querySelectorAll('.error-details-container')).toHaveLength(0);
6369

6470
await userEvent.click(document.querySelectorAll('.error-page-button')[2]);
65-
const question = document.querySelector('.error-details-container');
66-
expect(document.querySelector('.labkey-error-details-question').innerHTML.startsWith('What is a permission error?')).toBeTruthy();
71+
expect(
72+
document
73+
.querySelector('.labkey-error-details-question')
74+
.textContent.startsWith('What is a permission error?')
75+
).toBeTruthy();
6776

6877
// FIXME: the following cases are commented out because nearly the entire ErrorHandler component uses
6978
// non-component functions to render the contents, which prevents the code from being able to properly use the
@@ -79,7 +88,9 @@ describe('ErrorHandlerImpl', () => {
7988
message: 'This is a execution exception',
8089
};
8190
renderWithAppContext(<ErrorHandlerImpl context={{ errorDetails }} />);
82-
expect(document.querySelector('.labkey-error-subheading').innerHTML.includes(errorDetails.message)).toBeTruthy();
91+
expect(
92+
document.querySelector('.labkey-error-subheading').textContent.includes(errorDetails.message)
93+
).toBeTruthy();
8394
expect(document.querySelectorAll('.error-details-container')).toHaveLength(0);
8495

8596
await userEvent.click(document.querySelectorAll('.error-page-button')[2]);

core/src/client/ErrorHandler/ErrorType.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ const PERMISSION_DETAILS = (errorDetails: ErrorDetails) => (
176176
const CONFIGURATION_HEADING = () => 'Oops! A server configuration error has occurred.';
177177
const CONFIGURATION_SUBHEADING = (errorMessage?: string) => (
178178
<>
179-
{'The requested page cannot be found. '}
180179
{errorMessage !== undefined
181180
? errorMessage.endsWith('.')
182181
? errorMessage

0 commit comments

Comments
 (0)