@@ -26,7 +26,7 @@ public final class OsfInstitutionUtils {
2626
2727 public static boolean validateInstitutionForLogin (final JpaOsfDao jpaOsfDao , final String id ) {
2828 final OsfInstitution institution = jpaOsfDao .findOneInstitutionById (id );
29- return institution != null && institution .getDelegationProtocol () != null ;
29+ return institution != null && institution .getDelegationProtocol () != null && institution . getSsoAvailability () != SsoAvailability . UNAVAILABLE ;
3030 }
3131
3232 public static String getInstitutionSupportEmail (final JpaOsfDao jpaOsfDao , final String id ) {
@@ -37,13 +37,14 @@ public static String getInstitutionSupportEmail(final JpaOsfDao jpaOsfDao, final
3737 public static Map <String , String > getInstitutionLoginUrlMap (
3838 final JpaOsfDao jpaOsfDao ,
3939 final String target ,
40- final String id
40+ final String institutionId ,
41+ boolean isShortcutSso
4142 ) {
4243 List <OsfInstitution > institutionList = new LinkedList <>();
43- if (id == null || id .isEmpty ()) {
44+ if (institutionId == null || institutionId .isEmpty ()) {
4445 institutionList = jpaOsfDao .findAllInstitutions ();
4546 } else {
46- final OsfInstitution institution = jpaOsfDao .findOneInstitutionById (id );
47+ final OsfInstitution institution = jpaOsfDao .findOneInstitutionById (institutionId );
4748 if (institution != null ) {
4849 institutionList .add (institution );
4950 } else {
@@ -57,15 +58,21 @@ public static Map<String, String> getInstitutionLoginUrlMap(
5758 // Catch a rare exception case where OSF DB has changed the choices of the field
5859 // `sso_availability` in table `osf_institution` without syncing with CAS.
5960 LOGGER .error (
60- "Skipped due to invalid SSO Availability : [institutionId={}]" ,
61+ "Skip invalid SSO availability : [institutionId={}]" ,
6162 institution .getInstitutionId ()
6263 );
6364 continue ;
6465 }
65- if (!ssoAvailability .isPublic ()) {
66+ if (isShortcutSso && ssoAvailability .isHidden ()) {
67+ LOGGER .debug (
68+ "Show hidden SSO availability with shortcut URL: [institutionId={}, ssoAvailability={}]" ,
69+ institution .getInstitutionId (),
70+ ssoAvailability .getId ()
71+ );
72+ } else if (!ssoAvailability .isPublic ()) {
6673 // Hide institutions of which SSO Availability is not Public
6774 LOGGER .debug (
68- "Skipped because SSO Availability is not public : [institutionId={}, ssoAvailability={}]" ,
75+ "Skip non-public SSO availability : [institutionId={}, ssoAvailability={}]" ,
6976 institution .getInstitutionId (),
7077 ssoAvailability .getId ()
7178 );
0 commit comments