@Test public void shouldSubmitCallbacksUsingAuthContextIndexType() throws AuthLoginException { Callback[] callbacks = new Callback[0]; given(authContext.getIndexType()).willReturn(AuthIndexType.USER); LoginProcess loginP = loginProcess.next(callbacks); verify(authContext).submitRequirements(callbacks); assertEquals(loginP, loginProcess); }
public LoginProcess next(Callback[] callbacks) throws AuthLoginException { AuthIndexType indexType = authContext.getIndexType(); if (indexType == null) { indexType = loginConfiguration.getIndexType(); } if (AuthIndexType.LEVEL.equals(indexType) || AuthIndexType.COMPOSITE.equals(indexType)) { String choice = null; for (Callback responseCallback : callbacks) { if (responseCallback instanceof ChoiceCallback) { int selectedIndex = ((ChoiceCallback) responseCallback).getSelectedIndexes()[0]; choice = ((ChoiceCallback) responseCallback).getChoices()[selectedIndex]; break; } } String indexValue = coreServicesWrapper.getDataFromRealmQualifiedData(choice); String qualifiedRealm = coreServicesWrapper.getRealmFromRealmQualifiedData(choice); if ((qualifiedRealm != null) && (qualifiedRealm.length() != 0)) { String orgDN = coreServicesWrapper.orgNameToDN(qualifiedRealm); authContext.setOrgDN(orgDN); } int type = coreServicesWrapper.getCompositeAdviceType(authContext); if (type == AuthUtils.MODULE) { indexType = AuthIndexType.MODULE; } else if (type == AuthUtils.SERVICE) { indexType = AuthIndexType.SERVICE; } else if (type == AuthUtils.REALM) { indexType = AuthIndexType.SERVICE; String orgDN = coreServicesWrapper.orgNameToDN(choice); indexValue = coreServicesWrapper.getOrgConfiguredAuthenticationChain(orgDN); authContext.setOrgDN(orgDN); } else { indexType = AuthIndexType.MODULE; } loginConfiguration.indexType(indexType); loginConfiguration.indexValue(indexValue); return loginAuthenticator.startLoginProcess(this); } else { authContext.submitRequirements(callbacks); return this; } }
LoginProcess { public LoginProcess next(Callback[] callbacks) throws AuthLoginException { AuthIndexType indexType = authContext.getIndexType(); if (indexType == null) { indexType = loginConfiguration.getIndexType(); } if (AuthIndexType.LEVEL.equals(indexType) || AuthIndexType.COMPOSITE.equals(indexType)) { String choice = null; for (Callback responseCallback : callbacks) { if (responseCallback instanceof ChoiceCallback) { int selectedIndex = ((ChoiceCallback) responseCallback).getSelectedIndexes()[0]; choice = ((ChoiceCallback) responseCallback).getChoices()[selectedIndex]; break; } } String indexValue = coreServicesWrapper.getDataFromRealmQualifiedData(choice); String qualifiedRealm = coreServicesWrapper.getRealmFromRealmQualifiedData(choice); if ((qualifiedRealm != null) && (qualifiedRealm.length() != 0)) { String orgDN = coreServicesWrapper.orgNameToDN(qualifiedRealm); authContext.setOrgDN(orgDN); } int type = coreServicesWrapper.getCompositeAdviceType(authContext); if (type == AuthUtils.MODULE) { indexType = AuthIndexType.MODULE; } else if (type == AuthUtils.SERVICE) { indexType = AuthIndexType.SERVICE; } else if (type == AuthUtils.REALM) { indexType = AuthIndexType.SERVICE; String orgDN = coreServicesWrapper.orgNameToDN(choice); indexValue = coreServicesWrapper.getOrgConfiguredAuthenticationChain(orgDN); authContext.setOrgDN(orgDN); } else { indexType = AuthIndexType.MODULE; } loginConfiguration.indexType(indexType); loginConfiguration.indexValue(indexValue); return loginAuthenticator.startLoginProcess(this); } else { authContext.submitRequirements(callbacks); return this; } } }
LoginProcess { public LoginProcess next(Callback[] callbacks) throws AuthLoginException { AuthIndexType indexType = authContext.getIndexType(); if (indexType == null) { indexType = loginConfiguration.getIndexType(); } if (AuthIndexType.LEVEL.equals(indexType) || AuthIndexType.COMPOSITE.equals(indexType)) { String choice = null; for (Callback responseCallback : callbacks) { if (responseCallback instanceof ChoiceCallback) { int selectedIndex = ((ChoiceCallback) responseCallback).getSelectedIndexes()[0]; choice = ((ChoiceCallback) responseCallback).getChoices()[selectedIndex]; break; } } String indexValue = coreServicesWrapper.getDataFromRealmQualifiedData(choice); String qualifiedRealm = coreServicesWrapper.getRealmFromRealmQualifiedData(choice); if ((qualifiedRealm != null) && (qualifiedRealm.length() != 0)) { String orgDN = coreServicesWrapper.orgNameToDN(qualifiedRealm); authContext.setOrgDN(orgDN); } int type = coreServicesWrapper.getCompositeAdviceType(authContext); if (type == AuthUtils.MODULE) { indexType = AuthIndexType.MODULE; } else if (type == AuthUtils.SERVICE) { indexType = AuthIndexType.SERVICE; } else if (type == AuthUtils.REALM) { indexType = AuthIndexType.SERVICE; String orgDN = coreServicesWrapper.orgNameToDN(choice); indexValue = coreServicesWrapper.getOrgConfiguredAuthenticationChain(orgDN); authContext.setOrgDN(orgDN); } else { indexType = AuthIndexType.MODULE; } loginConfiguration.indexType(indexType); loginConfiguration.indexValue(indexValue); return loginAuthenticator.startLoginProcess(this); } else { authContext.submitRequirements(callbacks); return this; } } LoginProcess(LoginAuthenticator loginAuthenticator, LoginConfiguration loginConfiguration,
            AuthContextLocalWrapper authContext, CoreServicesWrapper coreServicesWrapper); }
LoginProcess { public LoginProcess next(Callback[] callbacks) throws AuthLoginException { AuthIndexType indexType = authContext.getIndexType(); if (indexType == null) { indexType = loginConfiguration.getIndexType(); } if (AuthIndexType.LEVEL.equals(indexType) || AuthIndexType.COMPOSITE.equals(indexType)) { String choice = null; for (Callback responseCallback : callbacks) { if (responseCallback instanceof ChoiceCallback) { int selectedIndex = ((ChoiceCallback) responseCallback).getSelectedIndexes()[0]; choice = ((ChoiceCallback) responseCallback).getChoices()[selectedIndex]; break; } } String indexValue = coreServicesWrapper.getDataFromRealmQualifiedData(choice); String qualifiedRealm = coreServicesWrapper.getRealmFromRealmQualifiedData(choice); if ((qualifiedRealm != null) && (qualifiedRealm.length() != 0)) { String orgDN = coreServicesWrapper.orgNameToDN(qualifiedRealm); authContext.setOrgDN(orgDN); } int type = coreServicesWrapper.getCompositeAdviceType(authContext); if (type == AuthUtils.MODULE) { indexType = AuthIndexType.MODULE; } else if (type == AuthUtils.SERVICE) { indexType = AuthIndexType.SERVICE; } else if (type == AuthUtils.REALM) { indexType = AuthIndexType.SERVICE; String orgDN = coreServicesWrapper.orgNameToDN(choice); indexValue = coreServicesWrapper.getOrgConfiguredAuthenticationChain(orgDN); authContext.setOrgDN(orgDN); } else { indexType = AuthIndexType.MODULE; } loginConfiguration.indexType(indexType); loginConfiguration.indexValue(indexValue); return loginAuthenticator.startLoginProcess(this); } else { authContext.submitRequirements(callbacks); return this; } } LoginProcess(LoginAuthenticator loginAuthenticator, LoginConfiguration loginConfiguration,
            AuthContextLocalWrapper authContext, CoreServicesWrapper coreServicesWrapper); LoginStage getLoginStage(); Callback[] getCallbacks(); PagePropertiesCallback getPagePropertiesCallback(); LoginProcess next(Callback[] callbacks); boolean isSuccessful(); AuthContextLocalWrapper getAuthContext(); LoginConfiguration getLoginConfiguration(); }
LoginProcess { public LoginProcess next(Callback[] callbacks) throws AuthLoginException { AuthIndexType indexType = authContext.getIndexType(); if (indexType == null) { indexType = loginConfiguration.getIndexType(); } if (AuthIndexType.LEVEL.equals(indexType) || AuthIndexType.COMPOSITE.equals(indexType)) { String choice = null; for (Callback responseCallback : callbacks) { if (responseCallback instanceof ChoiceCallback) { int selectedIndex = ((ChoiceCallback) responseCallback).getSelectedIndexes()[0]; choice = ((ChoiceCallback) responseCallback).getChoices()[selectedIndex]; break; } } String indexValue = coreServicesWrapper.getDataFromRealmQualifiedData(choice); String qualifiedRealm = coreServicesWrapper.getRealmFromRealmQualifiedData(choice); if ((qualifiedRealm != null) && (qualifiedRealm.length() != 0)) { String orgDN = coreServicesWrapper.orgNameToDN(qualifiedRealm); authContext.setOrgDN(orgDN); } int type = coreServicesWrapper.getCompositeAdviceType(authContext); if (type == AuthUtils.MODULE) { indexType = AuthIndexType.MODULE; } else if (type == AuthUtils.SERVICE) { indexType = AuthIndexType.SERVICE; } else if (type == AuthUtils.REALM) { indexType = AuthIndexType.SERVICE; String orgDN = coreServicesWrapper.orgNameToDN(choice); indexValue = coreServicesWrapper.getOrgConfiguredAuthenticationChain(orgDN); authContext.setOrgDN(orgDN); } else { indexType = AuthIndexType.MODULE; } loginConfiguration.indexType(indexType); loginConfiguration.indexValue(indexValue); return loginAuthenticator.startLoginProcess(this); } else { authContext.submitRequirements(callbacks); return this; } } LoginProcess(LoginAuthenticator loginAuthenticator, LoginConfiguration loginConfiguration,
            AuthContextLocalWrapper authContext, CoreServicesWrapper coreServicesWrapper); LoginStage getLoginStage(); Callback[] getCallbacks(); PagePropertiesCallback getPagePropertiesCallback(); LoginProcess next(Callback[] callbacks); boolean isSuccessful(); AuthContextLocalWrapper getAuthContext(); LoginConfiguration getLoginConfiguration();  }