Fix oracle
This commit is contained in:
parent
14683882e8
commit
2599e77491
7 changed files with 31 additions and 18 deletions
|
@ -154,11 +154,9 @@
|
|||
|
||||
<!-- Remove obsolete 'social' stuff -->
|
||||
<dropForeignKeyConstraint baseTableName="USER_SOCIAL_LINK" constraintName="FK_68CJYS5UWM55UY823Y75XG4OM" />
|
||||
<dropPrimaryKey tableName="USER_SOCIAL_LINK" constraintName="CONSTRAINT_3" />
|
||||
<dropTable tableName="USER_SOCIAL_LINK" />
|
||||
<dropTable tableName="USER_SOCIAL_LINK" cascadeConstraints="true" />
|
||||
<dropForeignKeyConstraint baseTableName="REALM_SOCIAL_CONFIG" constraintName="FK_SV5I3C2TI7G0G922FGE683SOV" />
|
||||
<dropPrimaryKey tableName="REALM_SOCIAL_CONFIG" constraintName="CONSTRAINT_1" />
|
||||
<dropTable tableName="REALM_SOCIAL_CONFIG" />
|
||||
<dropTable tableName="REALM_SOCIAL_CONFIG" cascadeConstraints="true" />
|
||||
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
||||
|
|
|
@ -25,7 +25,9 @@ public class MemoryUserCache implements UserCache {
|
|||
|
||||
@Override
|
||||
public CachedUser put(String key, CachedUser value) {
|
||||
if (value.getUsername() != null) {
|
||||
usersByUsername.put(value.getUsername(), value);
|
||||
}
|
||||
if (value.getEmail() != null) {
|
||||
usersByEmail.put(value.getEmail(), value);
|
||||
}
|
||||
|
@ -57,7 +59,7 @@ public class MemoryUserCache implements UserCache {
|
|||
}
|
||||
|
||||
private void removeUser(CachedUser value) {
|
||||
usersByUsername.remove(value.getUsername());
|
||||
if (value.getUsername() != null) usersByUsername.remove(value.getUsername());
|
||||
if (value.getEmail() != null) usersByEmail.remove(value.getEmail());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,9 +19,9 @@ import org.keycloak.provider.ProviderFactory;
|
|||
*
|
||||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
||||
*/
|
||||
public class MigrationUtils {
|
||||
public class DefaultMigrationProvider {
|
||||
|
||||
private MigrationUtils() {}
|
||||
private DefaultMigrationProvider() {}
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -29,11 +29,11 @@ public class MigrationUtils {
|
|||
* @param claimMask mask used on ClientModel in 1.1.0
|
||||
* @return set of 1.2.0.Beta1 protocol mappers corresponding to given claimMask
|
||||
*/
|
||||
public static Collection<ProtocolMapperModel> getMappersForClaimMask(KeycloakSession session, Long claimMask) {
|
||||
public static List<ProtocolMapperModel> getMappersForClaimMask(KeycloakSession session, Long claimMask) {
|
||||
Map<String, ProtocolMapperModel> allMappers = getAllDefaultMappers(session);
|
||||
|
||||
if (claimMask == null) {
|
||||
return allMappers.values();
|
||||
return new ArrayList<ProtocolMapperModel>(allMappers.values());
|
||||
}
|
||||
|
||||
if (!ClaimMask.hasUsername(claimMask)) {
|
||||
|
@ -48,7 +48,7 @@ public class MigrationUtils {
|
|||
allMappers.remove(OIDCLoginProtocolFactory.GIVEN_NAME);
|
||||
}
|
||||
|
||||
return allMappers.values();
|
||||
return new ArrayList<ProtocolMapperModel>(allMappers.values());
|
||||
}
|
||||
|
||||
private static Map<String, ProtocolMapperModel> getAllDefaultMappers(KeycloakSession session) {
|
|
@ -153,7 +153,7 @@ public abstract class AbstractIdentityProviderTest {
|
|||
|
||||
UserModel federatedUser = assertSuccessfulAuthentication(identityProviderModel, "test-user-noemail", null);
|
||||
|
||||
federatedUser.getRequiredActions().contains(RequiredAction.VERIFY_EMAIL);
|
||||
assertTrue(federatedUser.getRequiredActions().contains(RequiredAction.VERIFY_EMAIL));
|
||||
|
||||
} finally {
|
||||
getRealm().setVerifyEmail(false);
|
||||
|
|
|
@ -38,6 +38,11 @@ public class IdentityProviderHintTest {
|
|||
protected void configure(KeycloakSession session, RealmManager manager, RealmModel adminRealm) {
|
||||
server.importRealm(getClass().getResourceAsStream("/broker-test/test-broker-realm-with-kc-oidc.json"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] getTestRealms() {
|
||||
return new String[] { "realm-with-oidc-identity-provider" };
|
||||
}
|
||||
};
|
||||
|
||||
@Rule
|
||||
|
|
|
@ -19,6 +19,7 @@ import static org.junit.Assert.assertEquals;
|
|||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
/**
|
||||
|
@ -55,9 +56,12 @@ public class SAMLKeyCloakServerBrokerBasicTest extends AbstractIdentityProviderT
|
|||
if (identityProviderModel.isUpdateProfileFirstLogin()) {
|
||||
super.doAssertFederatedUser(federatedUser, identityProviderModel, expectedEmail);
|
||||
} else {
|
||||
if (expectedEmail == null)
|
||||
expectedEmail = "";
|
||||
if (expectedEmail == null) {
|
||||
// Need to handle differences for various databases (like Oracle)
|
||||
assertTrue(federatedUser.getEmail() == null || federatedUser.getEmail().equals(""));
|
||||
} else {
|
||||
assertEquals(expectedEmail, federatedUser.getEmail());
|
||||
}
|
||||
assertNull(federatedUser.getFirstName());
|
||||
assertNull(federatedUser.getLastName());
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import static org.junit.Assert.assertEquals;
|
|||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
/**
|
||||
|
@ -54,9 +55,12 @@ public class SAMLKeyCloakServerBrokerWithSignatureTest extends AbstractIdentityP
|
|||
if (identityProviderModel.isUpdateProfileFirstLogin()) {
|
||||
super.doAssertFederatedUser(federatedUser, identityProviderModel, expectedEmail);
|
||||
} else {
|
||||
if (expectedEmail == null)
|
||||
expectedEmail = "";
|
||||
if (expectedEmail == null) {
|
||||
// Need to handle differences for various databases (like Oracle)
|
||||
assertTrue(federatedUser.getEmail() == null || federatedUser.getEmail().equals(""));
|
||||
} else {
|
||||
assertEquals(expectedEmail, federatedUser.getEmail());
|
||||
}
|
||||
assertNull(federatedUser.getFirstName());
|
||||
assertNull(federatedUser.getLastName());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue