Class AuthRegistry
- java.lang.Object
-
- io.scalecube.services.testservice.AuthRegistry
-
public class AuthRegistry extends Object
So called "guess username" authentication. All preconfigured users can be authenticated.
-
-
Constructor Summary
Constructors Constructor Description AuthRegistry(Set<String> allowedUsers)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<String>addAuth(long sessionId, String auth)Add session with auth t registry.Optional<String>getAuth(long sessionId)Get session's auth data if exists.StringremoveAuth(long sessionId)Remove session from registry.
-
-
-
Method Detail
-
getAuth
public Optional<String> getAuth(long sessionId)
Get session's auth data if exists.- Parameters:
sessionId- session id to get auth info for- Returns:
- auth info for given session if exists
-
addAuth
public Optional<String> addAuth(long sessionId, String auth)
Add session with auth t registry.- Parameters:
sessionId- session id to add auth info forauth- auth info for given session id- Returns:
- auth info added for session id or empty if auth info is invalid
-
removeAuth
public String removeAuth(long sessionId)
Remove session from registry.- Parameters:
sessionId- session id to be removed from registry- Returns:
- true if session had auth info, false - otherwise
-
-