Skip to content

Commit df3699c

Browse files
committed
Replace "errorSource" with "casRedirectSource"
With recent FE rework on the "login again" link / button, how CAS handles such redirection no longer only applies to customized or flowless error pages. Thus, the property name and its query param name and accepted values have all been updated.
1 parent 95931a9 commit df3699c

15 files changed

Lines changed: 17 additions & 17 deletions

src/main/java/io/cos/cas/osf/web/flow/login/OsfAbstractLoginPreparationAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ public abstract class OsfAbstractLoginPreparationAction extends AbstractAuthenti
4343

4444
protected static final String PARAMETER_ORCID_REDIRECT_VALUE = "true";
4545

46-
protected static final String PARAMETER_ERROR_SOURCE = "errorSource";
46+
protected static final String PARAMETER_REDIRECT_SOURCE = "casRedirectSource";
4747

48-
protected static final List<String> EXPECTED_ERROR_CODES = new LinkedList<>(Arrays.asList("401", "403", "404", "405", "423", "-1"));
48+
protected static final List<String> EXPECTED_REDIRECT_CODES = new LinkedList<>(Arrays.asList("tomcat", "cas"));
4949

5050
public OsfAbstractLoginPreparationAction(
5151
final CasDelegatingWebflowEventResolver initialAuthenticationAttemptWebflowEventResolver,

src/main/java/io/cos/cas/osf/web/flow/login/OsfDefaultLoginPreparationAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ private String getEncodedServiceUrlFromRequestContext(final RequestContext conte
147147
}
148148

149149
private boolean isFromFlowlessErrorPage(final RequestContext context) {
150-
final String errorCode = context.getRequestParameters().get(PARAMETER_ERROR_SOURCE);
151-
return !StringUtils.isBlank(errorCode) && EXPECTED_ERROR_CODES.contains(errorCode);
150+
final String errorCode = context.getRequestParameters().get(PARAMETER_REDIRECT_SOURCE);
151+
return !StringUtils.isBlank(errorCode) && EXPECTED_REDIRECT_CODES.contains(errorCode);
152152
}
153153

154154
private Event continueToUsernamePasswordLogin() {

src/main/resources/templates/casAccountDisabledView.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ <h2 th:utext="#{screen.accountdisabled.heading}"></h2>
3333
</a>
3434
</section>
3535
<hr class="my-4" />
36-
<section class="text-with-mdi" th:with="loginUrl=@{/login(errorSource=401)}">
36+
<section class="text-with-mdi" th:with="loginUrl=@{/login(casRedirectSource=cas)}">
3737
<i class="mdi mdi-login mdi-before-text"></i>
3838
<span><a th:href="@{/logout(service=${loginUrl})}" th:utext="#{screen.error.page.loginagain}"></a></span>
3939
</section>

src/main/resources/templates/casInstitutionSsoFailedView.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<h2 th:utext="#{screen.institutionssofailed.heading}"></h2>
2828
<p th:utext="#{screen.institutionssofailed.message}"></p>
2929
</section>
30-
<section class="form-button" th:with="loginUrl=@{/login(errorSource=401)}">
30+
<section class="form-button" th:with="loginUrl=@{/login(casRedirectSource=cas)}">
3131
<a class="mdc-button mdc-button--raised button-osf-blue" th:href="@{/logout(service=${loginUrl})}">
3232
<span class="mdc-button__label" th:utext="#{screen.error.page.loginagain}"></span>
3333
</a>

src/main/resources/templates/casInvalidUserStatusView.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ <h2 th:utext="#{screen.invaliduserstatus.heading}"></h2>
3333
</a>
3434
</section>
3535
<hr class="my-4" />
36-
<section class="text-with-mdi" th:with="loginUrl=@{/login(errorSource=401)}">
36+
<section class="text-with-mdi" th:with="loginUrl=@{/login(casRedirectSource=cas)}">
3737
<i class="mdi mdi-login mdi-before-text"></i>
3838
<span><a th:href="@{/logout(service=${loginUrl})}" th:utext="#{screen.error.page.loginagain}"></a></span>
3939
</section>

src/main/resources/templates/casInvalidVerificationKeyView.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ <h2 th:utext="#{screen.invalidverificationkey.heading}"></h2>
3333
</a>
3434
</section>
3535
<hr class="my-4" />
36-
<section class="text-with-mdi" th:with="loginUrl=@{/login(errorSource=401)}">
36+
<section class="text-with-mdi" th:with="loginUrl=@{/login(casRedirectSource=cas)}">
3737
<i class="mdi mdi-login mdi-before-text"></i>
3838
<span><a th:href="@{/logout(service=${loginUrl})}" th:utext="#{screen.error.page.loginagain}"></a></span>
3939
</section>

src/main/resources/templates/casLogoutView.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ <h2 th:utext="#{screen.generic.logoutsuccess.heading}"></h2>
3535
<hr class="my-4" />
3636
<section class="text-with-mdi" th:with="loginUrl=@{/login(casRedirectSource=cas)}">
3737
<i class="mdi mdi-login mdi-before-text"></i>
38-
<span><a th:href="@{/login(casRedirectSource=200)}" th:utext="#{screen.generic.logoutsuccess.link.login}"></a></span>
38+
<span><a th:href="@{/login(casRedirectSource=cas)}" th:utext="#{screen.generic.logoutsuccess.link.login}"></a></span>
3939
</section>
4040
</section>
4141
</div>

src/main/resources/templates/casServiceErrorView.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<h2 th:utext="#{screen.service.error.heading}"></h2>
2828
<p th:if="${rootCauseException != null and rootCauseException.code != null}" th:utext="#{${rootCauseException.code}}"></p>
2929
</section>
30-
<section class="form-button" th:with="loginUrl=@{/login(errorSource=401)}">
30+
<section class="form-button" th:with="loginUrl=@{/login(casRedirectSource=cas)}">
3131
<a class="mdc-button mdc-button--raised button-osf-blue" th:href="@{/logout(service=${loginUrl})}">
3232
<span class="mdc-button__label" th:utext="#{screen.error.page.loginagain}"></span>
3333
</a>

src/main/resources/templates/error.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<h2 th:utext="#{screen.unavailable.heading}"></h2>
2828
<div th:utext="#{screen.unavailable.message}"></div>
2929
</section>
30-
<section class="form-button" th:with="loginUrl=@{/login(errorSource=401)}">
30+
<section class="form-button" th:with="loginUrl=@{/login(casRedirectSource=cas)}">
3131
<a class="mdc-button mdc-button--raised button-osf-blue" th:href="@{/logout(service=${loginUrl})}">
3232
<span class="mdc-button__label" th:utext="#{screen.error.page.loginagain}"></span>
3333
</a>

src/main/resources/templates/error/401.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ <h2 th:utext="#{screen.error.page.accessdenied}"></h2>
3535

3636
<section class="text-with-mdi">
3737
<i class="mdi mdi-login mdi-before-text"></i>
38-
<span><a th:href="@{/login(errorSource=401)}" th:utext="#{screen.error.page.loginagain}"></a></span>
38+
<span><a th:href="@{/login(casRedirectSource=tomcat)}" th:utext="#{screen.error.page.loginagain}"></a></span>
3939
</section>
4040

4141
</section>

0 commit comments

Comments
 (0)