Mercurial > hg > Applications > tvnjviewer
view src/main/java/com/glavsoft/rfb/protocol/auth/RequireAuthentication.java @ 15:e28c17afa0e9
add SecurityType.REQUIRE_AUTHENTICATION
author | one |
---|---|
date | Sun, 28 Sep 2014 11:59:14 +0900 |
parents | |
children |
line wrap: on
line source
package com.glavsoft.rfb.protocol.auth; import com.glavsoft.exceptions.TransportException; import com.glavsoft.rfb.CapabilityContainer; import com.glavsoft.rfb.IPasswordRetriever; import com.glavsoft.transport.Reader; import com.glavsoft.transport.Writer; public class RequireAuthentication extends AuthHandler { @Override public boolean authenticate(Reader reader, Writer writer, CapabilityContainer authCaps, IPasswordRetriever passwordRetriever) throws TransportException { byte[] headBuf = new byte[2]; reader.readBytes(headBuf); if (headBuf[1] == 2) { byte[] b = new byte[258]; reader.readBytes(b); byte[] outBuf = new byte[256]; writer.write(outBuf); writer.flush(); } else if (headBuf[1] == 23) { byte[] b = new byte[130]; reader.readBytes(b); byte[] outBuf = new byte[192]; writer.write(outBuf); writer.flush(); } return false; } @Override public SecurityType getType() { return SecurityType.REQUIRE_AUTHENTICATION; } }