Package org.zeromq
Class ZAuth
java.lang.Object
org.zeromq.ZAuth
- All Implemented Interfaces:
Closeable
,AutoCloseable
A ZAuth actor takes over authentication for all incoming connections in
its context. You can whitelist or blacklist peers based on IP address,
and define policies for securing PLAIN, CURVE, and GSSAPI connections.
Note that libzmq provides four levels of security: default NULL (which ZAuth does not see), and authenticated NULL, PLAIN, and CURVE, which ZAuth can see.
Based on zauth.c in czmq
Note that libzmq provides four levels of security: default NULL (which ZAuth does not see), and authenticated NULL, PLAIN, and CURVE, which ZAuth can see.
Based on zauth.c in czmq
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
private static class
AuthActor is the backend actor which we talk to over a pipe.static class
static class
static class
static class
static class
A small class for working with ZAP requests and replies. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ZAgent
private static final String
static final String
private static final String
private final ZStar.Exit
private final ZAgent
private static final String
private boolean
private static final String
private static final String
private static final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAllow (whitelist) a single IP address.void
close()
Destructor.configureCurve
(String location) Configure CURVE authenticationconfigurePlain
(String domain, String filename) Configure PLAIN authentication for a given domain.private static Map
<String, ZAuth.Auth> curveVariant
(ZCertStore.Fingerprinter fingerprinter) Deny (blacklist) a single IP address.void
destroy()
Destructor.private static Map
<String, ZAuth.Auth> Retrieves the next ZAP reply.nextReply
(boolean wait) Retrieves the next ZAP reply.nextReply
(int timeout) Retrieves the next ZAP reply.replies
(boolean enable) protected ZAuth
setVerbose
(boolean verbose) Enable verbose tracing of commands and activityverbose
(boolean verbose)
-
Field Details
-
ZAP_VERSION
- See Also:
-
CURVE_ALLOW_ANY
- See Also:
-
VERBOSE
- See Also:
-
REPLIES
- See Also:
-
ALLOW
- See Also:
-
DENY
- See Also:
-
TERMINATE
- See Also:
-
agent
-
exit
-
replies
-
repliesEnabled
private boolean repliesEnabled
-
-
Constructor Details
-
ZAuth
Install authentication for the specified context. Note that until you add policies, all incoming NULL connections are allowed (classic ZeroMQ behavior), and all PLAIN and CURVE connections are denied.- Parameters:
ctx
-
-
ZAuth
-
ZAuth
-
ZAuth
-
-
Method Details
-
makeSimpleAuths
-
curveVariant
-
setVerbose
Enable verbose tracing of commands and activity- Parameters:
verbose
-
-
verbose
-
allow
Allow (whitelist) a single IP address. For NULL, all clients from this address will be accepted. For PLAIN and CURVE, they will be allowed to continue with authentication. You can call this method multiple times to whitelist multiple IP addresses. If you whitelist a single address, any non-whitelisted addresses are treated as blacklisted.- Parameters:
address
-
-
deny
Deny (blacklist) a single IP address. For all security mechanisms, this rejects the connection without any further authentication. Use either a whitelist, or a blacklist, not not both. If you define both a whitelist and a blacklist, only the whitelist takes effect.- Parameters:
address
-
-
configurePlain
Configure PLAIN authentication for a given domain. PLAIN authentication uses a plain-text password file. To cover all domains, use "*". You can modify the password file at any time; it is reloaded automatically.- Parameters:
domain
-filename
-
-
configureCurve
Configure CURVE authentication- Parameters:
location
- Can be ZAuth.CURVE_ALLOW_ANY or a directory with public-keys that will be accepted
-
replies
-
nextReply
Retrieves the next ZAP reply.- Returns:
- the next reply or null if the actor is closed.
-
nextReply
Retrieves the next ZAP reply.- Parameters:
wait
- true to wait for the next reply, false to immediately return if there is no next reply.- Returns:
- the next reply or null if the actor is closed or if there is no next reply yet.
-
nextReply
Retrieves the next ZAP reply.- Parameters:
timeout
- the timeout in milliseconds to wait for a reply before giving up and returning null.- Returns:
- the next reply or null if the actor is closed or if there is no next reply after the elapsed timeout.
-
close
Destructor.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
destroy
public void destroy()Destructor. -
send
-