Skip to content

Commit

Permalink
chore: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoayyed committed Feb 27, 2025
1 parent 8f03bc1 commit 63620c2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.apereo.cas.configuration.model.support.ldap.AbstractLdapSearchProperties;
import org.apereo.cas.configuration.support.RegularExpressionCapable;
import org.apereo.cas.configuration.support.RequiredProperty;
import org.apereo.cas.configuration.support.RequiresModule;
import lombok.Getter;
import lombok.Setter;
Expand All @@ -26,12 +27,14 @@ public class PasswordlessAuthenticationLdapAccountsProperties extends AbstractLd
* Name of the LDAP attribute that
* indicates the user's email address.
*/
@RequiredProperty
private String emailAttribute = "mail";

/**
* Name of the LDAP attribute that
* indicates the user's phone.
*/
@RequiredProperty
private String phoneAttribute = "phoneNumber";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentSkipListSet;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;

Expand Down Expand Up @@ -268,6 +269,10 @@ public void responseBodySupplier(final Supplier<Resource> sup) {
this.worker.setResourceSupplier(sup);
}

public void headersConsumer(final Consumer<Map<String, String>> consumer) {
this.worker.setHeadersConsumer(consumer);
}

/**
* Starts the Web server so it can accept requests on the listening port.
*/
Expand Down Expand Up @@ -337,6 +342,9 @@ private static final class Worker implements Runnable {
@Setter
private Supplier<Resource> resourceSupplier;

@Setter
private Consumer<Map<String, String>> headersConsumer;

private boolean running;

Worker(final ServerSocket sock, final String contentType) {
Expand Down Expand Up @@ -397,7 +405,11 @@ public synchronized void run() {
}
}
LOGGER.debug("Headers are [{}]", givenHeaders);
if (this.functionToExecute != null) {
if (headersConsumer != null) {
headersConsumer.accept(givenHeaders);
}

if (functionToExecute != null) {
LOGGER.trace("Executed function with result [{}]", functionToExecute.apply(socket));
} else {
writeResponse(socket);
Expand Down

0 comments on commit 63620c2

Please sign in to comment.