Skip to content

Commit 5d0bfbf

Browse files
committed
Remove empty action and update flow for unsupported institution login
In addition, fixed one bug where a wrong setter was called to set the "encodedServiceUrl"; and improved case-insensitive check by using the ".equalsIgnoreCase()" instead of ".toLowerCase()"
1 parent 3055e2c commit 5d0bfbf

5 files changed

Lines changed: 6 additions & 88 deletions

File tree

src/main/java/io/cos/cas/osf/web/config/OsfCasSupportActionsConfiguration.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import io.cos.cas.osf.dao.JpaOsfDao;
44
import io.cos.cas.osf.web.flow.login.OsfDefaultLoginPreparationAction;
55
import io.cos.cas.osf.web.flow.login.OsfInstitutionLoginPreparationAction;
6-
import io.cos.cas.osf.web.flow.login.OsfUnsupportedInstitutionLoginPreparationAction;
76
import io.cos.cas.osf.web.flow.login.OsfCasPreInitialFlowSetupAction;
87
import io.cos.cas.osf.web.flow.login.OsfPrincipalFromNonInteractiveCredentialsAction;
98

@@ -126,18 +125,4 @@ public Action osfInstitutionLoginCheckAction() {
126125
casProperties.getAuthn().getOsfPostgres().getInstitutionClients()
127126
);
128127
}
129-
130-
/**
131-
* Bean configuration for {@link OsfUnsupportedInstitutionLoginPreparationAction}.
132-
*
133-
* @return the initialized action
134-
*/
135-
@Bean
136-
public Action osfUnsupportedInstitutionLoginCheckAction() {
137-
return new OsfUnsupportedInstitutionLoginPreparationAction(
138-
initialAuthenticationAttemptWebflowEventResolver.getObject(),
139-
serviceTicketRequestWebflowEventResolver.getObject(),
140-
adaptiveAuthenticationPolicy.getObject()
141-
);
142-
}
143128
}

src/main/java/io/cos/cas/osf/web/flow/configurer/OsfCasLoginWebflowConfigurer.java

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ protected void createDefaultActionStates(final Flow flow) {
140140
// Create the customized interactive login check actions
141141
createOsfDefaultLoginCheckAction(flow);
142142
createOsfInstitutionLoginCheckAction(flow);
143-
createOsfUnsupportedInstitutionLoginCheckAction(flow);
144143
// Create the customized non-interactive authentication check action
145144
createOsfNonInteractiveAuthenticationCheckAction(flow);
146145
}
@@ -332,7 +331,7 @@ private void createOsfDefaultLoginCheckAction(final Flow flow) {
332331
createTransitionForState(
333332
action,
334333
OsfCasWebflowConstants.TRANSITION_ID_UNSUPPORTED_INSTITUTION_LOGIN,
335-
OsfCasWebflowConstants.STATE_ID_OSF_UNSUPPORTED_INSTITUTION_LOGIN_CHECK
334+
OsfCasWebflowConstants.VIEW_ID_UNSUPPORTED_INSTITUTION_SSO_INIT
336335
);
337336
createTransitionForState(
338337
action,
@@ -374,29 +373,6 @@ private void createOsfInstitutionLoginCheckAction(final Flow flow) {
374373
);
375374
}
376375

377-
/**
378-
* Create the unsupported institution login check / preparation action for OSF CAS.
379-
*
380-
* @param flow the flow
381-
*/
382-
private void createOsfUnsupportedInstitutionLoginCheckAction(final Flow flow) {
383-
ActionState action = createActionState(
384-
flow,
385-
OsfCasWebflowConstants.STATE_ID_OSF_UNSUPPORTED_INSTITUTION_LOGIN_CHECK,
386-
OsfCasWebflowConstants.ACTION_ID_OSF_UNSUPPORTED_INSTITUTION_LOGIN_CHECK
387-
);
388-
createTransitionForState(
389-
action,
390-
CasWebflowConstants.TRANSITION_ID_ERROR,
391-
OsfCasWebflowConstants.VIEW_ID_INSTITUTION_SSO_FAILED
392-
);
393-
createTransitionForState(
394-
action,
395-
CasWebflowConstants.TRANSITION_ID_SUCCESS,
396-
OsfCasWebflowConstants.VIEW_ID_UNSUPPORTED_INSTITUTION_SSO_INIT
397-
);
398-
}
399-
400376
/**
401377
* Create extra authentication exception view states for OSF CAS.
402378
*
@@ -538,7 +514,7 @@ protected void createInstitutionLoginView(final Flow flow) {
538514
}
539515

540516
/**
541-
* Create the institution SSO init view state to support the OSF feature "sign-in via institutions".
517+
* Create the unsupported institution view state to support the OSF feature "I can't find my institution".
542518
*
543519
* @param flow the flow
544520
*/

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ protected Event doExecute(RequestContext context) {
8282
defaultServiceUrl
8383
);
8484
} else {
85-
loginContext.setDefaultServiceUrl(encodedServiceUrl);
85+
loginContext.setEncodedServiceUrl(encodedServiceUrl);
8686
loginContext.setInstitutionLogin(institutionLogin);
8787
loginContext.setInstitutionId(institutionId);
8888
loginContext.setUnsupportedInstitutionLogin(unsupportedInstitutionLogin);
@@ -116,7 +116,7 @@ protected Event doExecute(RequestContext context) {
116116

117117
private boolean isInstitutionLogin(final RequestContext context) {
118118
final String campaign = context.getRequestParameters().get(PARAMETER_CAMPAIGN);
119-
return StringUtils.isNotBlank(campaign) && PARAMETER_CAMPAIGN_VALUE.equals(campaign.toLowerCase());
119+
return StringUtils.isNotBlank(campaign) && PARAMETER_CAMPAIGN_VALUE.equalsIgnoreCase(campaign);
120120
}
121121

122122
private String getInstitutionIdFromRequestContext(final RequestContext context) {
@@ -126,13 +126,13 @@ private String getInstitutionIdFromRequestContext(final RequestContext context)
126126

127127
private boolean isUnsupportedInstitutionLogin(final RequestContext context) {
128128
final String campaign = context.getRequestParameters().get(PARAMETER_CAMPAIGN);
129-
return StringUtils.isNotBlank(campaign) && PARAMETER_CAMPAIGN_UNSUPPORTED_INSTITUTION_VALUE.equals(campaign.toLowerCase());
129+
return StringUtils.isNotBlank(campaign) && PARAMETER_CAMPAIGN_UNSUPPORTED_INSTITUTION_VALUE.equalsIgnoreCase(campaign);
130130
}
131131

132132
private boolean isOrcidLoginAutoRedirect(final RequestContext context) {
133133
final String orcidRedirect = context.getRequestParameters().get(PARAMETER_ORCID_REDIRECT);
134134
return StringUtils.isNotBlank(orcidRedirect)
135-
&& PARAMETER_ORCID_REDIRECT_VALUE.equals(orcidRedirect.toLowerCase());
135+
&& PARAMETER_ORCID_REDIRECT_VALUE.equalsIgnoreCase(orcidRedirect);
136136
}
137137

138138
private String getOrcidLoginUrlFromFlowScope(final RequestContext context) {

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

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/main/java/io/cos/cas/osf/web/flow/support/OsfCasWebflowConstants.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ public interface OsfCasWebflowConstants {
2020

2121
String ACTION_ID_OSF_INSTITUTION_LOGIN_CHECK = "osfInstitutionLoginCheckAction";
2222

23-
String ACTION_ID_OSF_UNSUPPORTED_INSTITUTION_LOGIN_CHECK = "osfUnsupportedInstitutionLoginCheckAction";
24-
2523
String TRANSITION_ID_USERNAME_PASSWORD_LOGIN = "continueToUsernamePasswordLogin";
2624

2725
String TRANSITION_ID_INSTITUTION_LOGIN = "switchToInstitutionLogin";
@@ -38,8 +36,6 @@ public interface OsfCasWebflowConstants {
3836

3937
String STATE_ID_OSF_INSTITUTION_LOGIN_CHECK = "osfInstitutionLoginCheck";
4038

41-
String STATE_ID_OSF_UNSUPPORTED_INSTITUTION_LOGIN_CHECK = "osfUnsupportedInstitutionLoginCheck";
42-
4339
String VIEW_ID_INSTITUTION_SSO_INIT = "casInstitutionLoginView";
4440

4541
String VIEW_ID_UNSUPPORTED_INSTITUTION_SSO_INIT = "casUnsupportedInstitutionLoginView";

0 commit comments

Comments
 (0)