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