mirror of https://github.com/jacekkow/keycloak-protocol-cas

Mateusz Małek
2022-11-07 ea95558acf6c66acdfca2a3d25032e7e2ec45f50
Update to Keycloak 20.0.0
5 files modified
16 ■■■■■ changed files
pom.xml 4 ●●●● patch | view | raw | blame | history
src/main/java/org/keycloak/protocol/cas/endpoints/AbstractValidateEndpoint.java 5 ●●●●● patch | view | raw | blame | history
src/main/java/org/keycloak/protocol/cas/endpoints/AuthorizationEndpoint.java 2 ●●● patch | view | raw | blame | history
src/main/java/org/keycloak/protocol/cas/endpoints/LogoutEndpoint.java 2 ●●● patch | view | raw | blame | history
src/main/java/org/keycloak/protocol/cas/mappers/GroupMembershipMapper.java 3 ●●●● patch | view | raw | blame | history
pom.xml
@@ -22,7 +22,7 @@
    <groupId>org.keycloak</groupId>
    <artifactId>keycloak-protocol-cas</artifactId>
    <version>19.0.3</version>
    <version>20.0.0</version>
    <name>Keycloak CAS Protocol</name>
    <description />
@@ -36,7 +36,7 @@
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.source>1.8</maven.compiler.source>
        <project.build.outputTimestamp>1665133202</project.build.outputTimestamp>
        <project.build.outputTimestamp>1667379314</project.build.outputTimestamp>
    </properties>
    <dependencies>
src/main/java/org/keycloak/protocol/cas/endpoints/AbstractValidateEndpoint.java
@@ -22,6 +22,7 @@
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
public abstract class AbstractValidateEndpoint {
    protected final Logger logger = Logger.getLogger(getClass());
@@ -61,7 +62,7 @@
            throw new CASValidationException(CASErrorCode.INVALID_REQUEST, "Missing parameter: " + CASLoginProtocol.SERVICE_PARAM, Response.Status.BAD_REQUEST);
        }
        client = realm.getClients().stream()
        client = realm.getClientsStream()
                .filter(c -> CASLoginProtocol.LOGIN_PROTOCOL.equals(c.getProtocol()))
                .filter(c -> RedirectUtils.verifyRedirectUri(session, service, c) != null)
                .findFirst().orElse(null);
@@ -155,7 +156,7 @@
        // CAS protocol does not support scopes, so pass null scopeParam
        ClientSessionContext clientSessionCtx = DefaultClientSessionContext.fromClientSessionAndScopeParameter(clientSession, null, session);
        Set<ProtocolMapperModel> mappings = clientSessionCtx.getProtocolMappers();
        Set<ProtocolMapperModel> mappings = clientSessionCtx.getProtocolMappersStream().collect(Collectors.toSet());
        KeycloakSessionFactory sessionFactory = session.getKeycloakSessionFactory();
        Map<String, Object> attributes = new HashMap<>();
        for (ProtocolMapperModel mapping : mappings) {
src/main/java/org/keycloak/protocol/cas/endpoints/AuthorizationEndpoint.java
@@ -76,7 +76,7 @@
            throw new ErrorPageException(session, Response.Status.BAD_REQUEST, Messages.MISSING_PARAMETER, CASLoginProtocol.SERVICE_PARAM);
        }
        client = realm.getClients().stream()
        client = realm.getClientsStream()
                .filter(c -> CASLoginProtocol.LOGIN_PROTOCOL.equals(c.getProtocol()))
                .filter(c -> RedirectUtils.verifyRedirectUri(session, service, c) != null)
                .findFirst().orElse(null);
src/main/java/org/keycloak/protocol/cas/endpoints/LogoutEndpoint.java
@@ -70,7 +70,7 @@
            return;
        }
        client = realm.getClients().stream()
        client = realm.getClientsStream()
                .filter(c -> CASLoginProtocol.LOGIN_PROTOCOL.equals(c.getProtocol()))
                .filter(c -> RedirectUtils.verifyRedirectUri(session, service, c) != null)
                .findFirst().orElse(null);
src/main/java/org/keycloak/protocol/cas/mappers/GroupMembershipMapper.java
@@ -9,6 +9,7 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class GroupMembershipMapper extends AbstractCASProtocolMapper {
    private static final List<ProviderConfigProperty> configProperties = new ArrayList<ProviderConfigProperty>();
@@ -54,7 +55,7 @@
                             KeycloakSession session, ClientSessionContext clientSessionCt) {
        List<String> membership = new LinkedList<>();
        boolean fullPath = useFullPath(mappingModel);
        for (GroupModel group : userSession.getUser().getGroups()) {
        for (GroupModel group : userSession.getUser().getGroupsStream().collect(Collectors.toSet())) {
            if (fullPath) {
                membership.add(ModelToRepresentation.buildGroupPath(group));
            } else {