Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Keycloak 20.0.0 #61

Merged
merged 1 commit into from
Nov 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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 />

Expand All @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -61,7 +62,7 @@ protected void checkClient(String service) {
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);
Expand Down Expand Up @@ -155,7 +156,7 @@ protected Map<String, Object> getUserAttributes() {
// 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private void checkClient(String service) {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private void checkClient(String service) {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>();
Expand Down Expand Up @@ -54,7 +55,7 @@ public void setAttribute(Map<String, Object> attributes, ProtocolMapperModel map
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 {
Expand Down