Skip to content

Commit 29a176f

Browse files
committed
Added javadocs for PrincipalMapper
1 parent a8886dd commit 29a176f

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

services-api/src/main/java/io/scalecube/services/auth/Principal.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
public interface Principal {
1010

1111
/**
12-
* A constant representing a "null" principal, which signifies an unauthenticated entity. This
13-
* principal does not have any roles or permissions.
12+
* Null principal, which signifies an unauthenticated entity. This principal does not have any
13+
* roles or permissions.
1414
*/
1515
Principal NULL_PRINCIPAL =
1616
new Principal() {

services-api/src/main/java/io/scalecube/services/auth/PrincipalMapper.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,23 @@
33
import io.scalecube.services.RequestContext;
44
import reactor.core.publisher.Mono;
55

6+
/**
7+
* Functional interface for transforming existing {@link Principal} from {@link RequestContext} to
8+
* the new {@link Principal}. This interface allows to modify or replace a current principal from
9+
* {@link RequestContext}, allowing for dynamic adjustments to authentication and authorization
10+
* logic based on the request context.
11+
*
12+
* @see Principal
13+
* @see RequestContext
14+
*/
615
@FunctionalInterface
716
public interface PrincipalMapper {
817

18+
/**
19+
* Maps current principal in the provided {@link RequestContext} to the new {@link Principal}.
20+
*
21+
* @param requestContext {@link RequestContext} containing the current principal
22+
* @return {@link Mono} emitting the new {@link Principal} after the transformation
23+
*/
924
Mono<Principal> map(RequestContext requestContext);
1025
}

0 commit comments

Comments
 (0)