long uniqueId = getUniqueId();
@Test public void pre65NonSecureShouldReturnUserAuthId() { long userAuthId = 12345L; serverConnection.setUserAuthId(userAuthId); when(handshake.getVersion()).thenReturn(Version.GFE_61); when(requestMsg.isSecureMode()).thenReturn(false); assertThat(serverConnection.getUniqueId()).isEqualTo(userAuthId); }
@Test public void pre65SecureShouldReturnUserAuthId() { long userAuthId = 12345L; serverConnection.setUserAuthId(userAuthId); when(handshake.getVersion()).thenReturn(Version.GFE_61); when(requestMsg.isSecureMode()).thenReturn(true); assertThat(serverConnection.getUniqueId()).isEqualTo(userAuthId); }
public AuthorizeRequestPP getPostAuthzRequest() throws AuthenticationRequiredException, IOException { if (!AcceptorImpl.isAuthenticationRequired()) { return null; } if (securityService.isIntegratedSecurity()) { return null; } // look client version and return authzrequest // for backward client it will be store in member variable userAuthId // for other look "requestMessage" here and get unique-id from this to get the authzrequest long uniqueId = getUniqueId(); UserAuthAttributes uaa = null; try { uaa = this.clientUserAuths.getUserAuthAttributes(uniqueId); } catch (NullPointerException npe) { if (this.isTerminated()) { // Bug #52023. throw new IOException("Server connection is terminated."); } else { logger.debug("Unexpected exception {}", npe); } } if (uaa == null) { throw new AuthenticationRequiredException("User authorization attributes not found."); } return uaa.getPostAuthzRequest(); }
private void setAuthAttributes() throws Exception { logger.debug("setAttributes()"); Object principal = getHandshake().verifyCredentials(); long uniqueId; if (principal instanceof Subject) { uniqueId = getClientUserAuths(getProxyID()).putSubject((Subject) principal); } else { // this sets principal in map as well.... uniqueId = getUniqueId((Principal) principal); setPrincipal((Principal) principal); } setUserAuthId(uniqueId); }
@Test public void post65SecureShouldUseUniqueIdFromMessage() { long uniqueIdFromMessage = 23456L; when(handshake.getVersion()).thenReturn(Version.GFE_82); serverConnection.setRequestMessage(requestMsg); assertThat(serverConnection.getRequestMessage()).isSameAs(requestMsg); when(requestMsg.isSecureMode()).thenReturn(true); when(messageIdExtractor.getUniqueIdFromMessage(any(Message.class), any(Encryptor.class), anyLong())).thenReturn(uniqueIdFromMessage); serverConnection.setMessageIdExtractor(messageIdExtractor); assertThat(serverConnection.getUniqueId()).isEqualTo(uniqueIdFromMessage); }
&& !isInternalMessage(this.requestMessage, allowInternalMessagesWithoutCredentials) && !this.communicationMode.isWAN()) { long uniqueId = getUniqueId(); String messageType = MessageType.getString(this.requestMessage.getMessageType()); Subject subject = this.clientUserAuths.getSubject(uniqueId);
} else { uniqueId = getUniqueId((Principal) principal);