@Test public void authRequiredHasCredentials() throws Exception { Handshake.throwIfMissingRequiredCredentials(true, true); }
@Test public void authNotRequiredHasCredentials() throws Exception { Handshake.throwIfMissingRequiredCredentials(false, true); }
@Test public void authNotRequiredHasNoCredentials() throws Exception { Handshake.throwIfMissingRequiredCredentials(false, false); }
@Test public void authRequiredHasNoCredentials() throws Exception { assertThatThrownBy(() -> Handshake.throwIfMissingRequiredCredentials(true, false)) .isExactlyInstanceOf(AuthenticationRequiredException.class) .hasMessage("No security credentials are provided"); }
Properties readCredential(DataInputStream dis, DataOutputStream dos, DistributedSystem system) throws GemFireSecurityException, IOException { Properties credentials = null; boolean requireAuthentication = securityService.isClientSecurityRequired(); try { byte secureMode = dis.readByte(); throwIfMissingRequiredCredentials(requireAuthentication, secureMode != CREDENTIALS_NONE); if (secureMode == CREDENTIALS_NORMAL) { encryptor.setAppSecureMode(CREDENTIALS_NORMAL); } else if (secureMode == CREDENTIALS_DHENCRYPT) { encryptor.readEncryptedCredentials(dis, dos, system, requireAuthentication); } } catch (IOException ex) { throw ex; } catch (GemFireSecurityException ex) { throw ex; } catch (Exception ex) { throw new AuthenticationFailedException( "Failure in reading credentials", ex); } return credentials; }
try { byte secureMode = dis.readByte(); throwIfMissingRequiredCredentials(requireAuthentication, secureMode != CREDENTIALS_NONE); if (secureMode == CREDENTIALS_NORMAL) { if (requireAuthentication) {