java.lang.Object
net.i2p.i2pcontrol.servlets.jsonrpc2handlers.AuthenticateHandler
- All Implemented Interfaces:
RequestHandler
JSON-RPC handler for authentication requests. Processes authentication and token generation for I2PControl API access.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final JSONRPC2HelperReads the request's arguments.private static final LogLogger for this class.private final SecurityManagerIssues the token on success.private static final String[]Arguments the request must carry.Constructor Summary
ConstructorsConstructorDescriptionAuthenticateHandler(JSONRPC2Helper helper, SecurityManager secMan) Binds the reply helper and the token-issuing security manager.Method Summary
Modifier and TypeMethodDescriptionString[]Method names this handler services.process(JSONRPC2Request req, MessageContext ctx) Process an Authenticate requestprivate static JSONRPC2ErrorvalidateAPIVersion(Object api) Validate the provided I2PControl API version against the ones supported by I2PControl.
Field Details
_log
Logger for this class.requiredArgs
Arguments the request must carry._helper
Reads the request's arguments._secMan
Issues the token on success.
Constructor Details
AuthenticateHandler
Binds the reply helper and the token-issuing security manager.- Parameters:
helper- resolves the localized strings and version data used in the replysecMan- issues and tracks the authentication tokens
Method Details
handledRequests
Method names this handler services.- Specified by:
handledRequestsin interfaceRequestHandler- Returns:
- method names handled by this handler
process
Process an Authenticate request- Specified by:
processin interfaceRequestHandler- Parameters:
req- A valid JSON-RPC 2.0 request instance. Must not benull.ctx- Context information about the request message, may benullif undefined.- Returns:
- The resulting JSON-RPC 2.0 response. It indicates success or an error, such as METHOD_NOT_FOUND.
validateAPIVersion
Validate the provided I2PControl API version against the ones supported by I2PControl.- Parameters:
api- the API version value from the request- Returns:
- null if the version is supported, an error otherwise