diff options
-rw-r--r-- | lib/src/main/kotlin/Connection.kt | 2 | ||||
-rw-r--r-- | lib/src/main/kotlin/ProtocolTranslator.kt | 18 |
2 files changed, 17 insertions, 3 deletions
diff --git a/lib/src/main/kotlin/Connection.kt b/lib/src/main/kotlin/Connection.kt index 871f5be..5557215 100644 --- a/lib/src/main/kotlin/Connection.kt +++ b/lib/src/main/kotlin/Connection.kt @@ -100,7 +100,7 @@ class Connection(transLay: TransportLayer) : ProtocolTranslator { } } - override fun auth(afid: UInt, uname: String, aname: String) { + override fun auth(afid: UInt, uname: String, aname: String, auther: Authenticator) { // TODO: Leave this unimplemented until p9any and TLS are implemented } diff --git a/lib/src/main/kotlin/ProtocolTranslator.kt b/lib/src/main/kotlin/ProtocolTranslator.kt index 8af0aea..24c4f90 100644 --- a/lib/src/main/kotlin/ProtocolTranslator.kt +++ b/lib/src/main/kotlin/ProtocolTranslator.kt @@ -1,3 +1,5 @@ +// TODO: Add asynchronous message handling (as of now, the flush method is useless) + /** * The [ProtocolTranslator] interface provides methods which represent, and enclose, full 9P transactions. A call to any * of such methods requires filling in parameters, which coincide one-to-one with fields required by 9P requests. In an @@ -19,7 +21,7 @@ interface ProtocolTranslator { * been received. * * @param msize The maximum length, in bytes, that the client will ever generate or expect to receive in a single - * 9P message. + * 9P message. * @param version Should be "9P2000", which is the only defined value. * @throws except.InvalidMessageException if the received message is invalid. * @throws except.RErrorException if the received message is an R-error message. @@ -30,8 +32,20 @@ interface ProtocolTranslator { /** * Perform authentication. + * + * 9P itself neither defines a user authentication protocol in its specification, nor requires the usage of a + * specific existing one. However, it provides a way of running an authentication protocol of choice on top of + * itself, as long as both the client and the server agree on one. Right after the server's `R-auth` message, using + * 9P's `read` and `write` messages on the authentication FID, it is possible to exchange authentication messages. + * This [auth] method performs both the 9P `auth` transaction and the successive authentication protocol. + * + * @param afid A new FID for authentication. + * @param uname The user identifier. + * @param aname The file tree to access. + * @param auther The [Authenticator] instance that provides one or more authentication protocols. This parameter is + * NineKt-specific and does not appear in the protocol specification. */ - fun auth(afid: UInt, uname: String, aname: String) + fun auth(afid: UInt, uname: String, aname: String, auther: Authenticator) /** * Abort a message. |