private static Credentials extractCredentials(ClientRequestContext request, Type type) { String usernameKey = null; String passwordKey = null; if (type == null) { usernameKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_USERNAME; passwordKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_PASSWORD; } else if (type == Type.BASIC) { usernameKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_BASIC_USERNAME; passwordKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_BASIC_PASSWORD; } else if (type == Type.DIGEST) { usernameKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_DIGEST_USERNAME; passwordKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_DIGEST_PASSWORD; } String userName = (String) request.getProperty(usernameKey); if (userName != null && !userName.equals("")) { byte[] pwdBytes; Object password = request.getProperty(passwordKey); if (password instanceof byte[]) { pwdBytes = ((byte[]) password); } else if (password instanceof String) { pwdBytes = ((String) password).getBytes(CHARACTER_SET); } else { throw new RequestAuthenticationException( LocalizationMessages.AUTHENTICATION_CREDENTIALS_REQUEST_PASSWORD_UNSUPPORTED()); } return new Credentials(userName, pwdBytes); } return null; }
private static Credentials extractCredentials(ClientRequestContext request, Type type) { String usernameKey = null; String passwordKey = null; if (type == null) { usernameKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_USERNAME; passwordKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_PASSWORD; } else if (type == Type.BASIC) { usernameKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_BASIC_USERNAME; passwordKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_BASIC_PASSWORD; } else if (type == Type.DIGEST) { usernameKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_DIGEST_USERNAME; passwordKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_DIGEST_PASSWORD; } String userName = (String) request.getProperty(usernameKey); if (userName != null && !userName.equals("")) { byte[] pwdBytes; Object password = request.getProperty(passwordKey); if (password instanceof byte[]) { pwdBytes = ((byte[]) password); } else if (password instanceof String) { pwdBytes = ((String) password).getBytes(CHARACTER_SET); } else { throw new RequestAuthenticationException( LocalizationMessages.AUTHENTICATION_CREDENTIALS_REQUEST_PASSWORD_UNSUPPORTED()); } return new Credentials(userName, pwdBytes); } return null; }
private static Credentials extractCredentials(ClientRequestContext request, Type type) { String usernameKey = null; String passwordKey = null; if (type == null) { usernameKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_USERNAME; passwordKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_PASSWORD; } else if (type == Type.BASIC) { usernameKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_BASIC_USERNAME; passwordKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_BASIC_PASSWORD; } else if (type == Type.DIGEST) { usernameKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_DIGEST_USERNAME; passwordKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_DIGEST_PASSWORD; } String userName = (String) request.getProperty(usernameKey); if (userName != null && !userName.equals("")) { byte[] pwdBytes; Object password = request.getProperty(passwordKey); if (password instanceof byte[]) { pwdBytes = ((byte[]) password); } else if (password instanceof String) { pwdBytes = ((String) password).getBytes(CHARACTER_SET); } else { throw new RequestAuthenticationException( LocalizationMessages.AUTHENTICATION_CREDENTIALS_REQUEST_PASSWORD_UNSUPPORTED()); } return new Credentials(userName, pwdBytes); } return null; }
private static Credentials extractCredentials(ClientRequestContext request, Type type) { String usernameKey = null; String passwordKey = null; if (type == null) { usernameKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_USERNAME; passwordKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_PASSWORD; } else if (type == Type.BASIC) { usernameKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_BASIC_USERNAME; passwordKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_BASIC_PASSWORD; } else if (type == Type.DIGEST) { usernameKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_DIGEST_USERNAME; passwordKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_DIGEST_PASSWORD; } String userName = (String) request.getProperty(usernameKey); if (userName != null && !userName.equals("")) { byte[] pwdBytes; Object password = request.getProperty(passwordKey); if (password instanceof byte[]) { pwdBytes = ((byte[]) password); } else if (password instanceof String) { pwdBytes = ((String) password).getBytes(CHARACTER_SET); } else { throw new RequestAuthenticationException( LocalizationMessages.AUTHENTICATION_CREDENTIALS_REQUEST_PASSWORD_UNSUPPORTED()); } return new Credentials(userName, pwdBytes); } return null; }
private static Credentials extractCredentials(ClientRequestContext request, Type type) { String usernameKey = null; String passwordKey = null; if (type == null) { usernameKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_USERNAME; passwordKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_PASSWORD; } else if (type == Type.BASIC) { usernameKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_BASIC_USERNAME; passwordKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_BASIC_PASSWORD; } else if (type == Type.DIGEST) { usernameKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_DIGEST_USERNAME; passwordKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_DIGEST_PASSWORD; } String userName = (String) request.getProperty(usernameKey); if (userName != null && !userName.equals("")) { byte[] pwdBytes; Object password = request.getProperty(passwordKey); if (password instanceof byte[]) { pwdBytes = ((byte[]) password); } else if (password instanceof String) { pwdBytes = ((String) password).getBytes(CHARACTER_SET); } else { throw new RequestAuthenticationException( LocalizationMessages.AUTHENTICATION_CREDENTIALS_REQUEST_PASSWORD_UNSUPPORTED()); } return new Credentials(userName, pwdBytes); } return null; }
private static Credentials extractCredentials(ClientRequestContext request, Type type) { String usernameKey = null; String passwordKey = null; if (type == null) { usernameKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_USERNAME; passwordKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_PASSWORD; } else if (type == Type.BASIC) { usernameKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_BASIC_USERNAME; passwordKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_BASIC_PASSWORD; } else if (type == Type.DIGEST) { usernameKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_DIGEST_USERNAME; passwordKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_DIGEST_PASSWORD; } String userName = (String) request.getProperty(usernameKey); if (userName != null && !userName.equals("")) { byte[] pwdBytes; Object password = request.getProperty(passwordKey); if (password instanceof byte[]) { pwdBytes = ((byte[]) password); } else if (password instanceof String) { pwdBytes = ((String) password).getBytes(CHARACTER_SET); } else { throw new RequestAuthenticationException( LocalizationMessages.AUTHENTICATION_CREDENTIALS_REQUEST_PASSWORD_UNSUPPORTED()); } return new Credentials(userName, pwdBytes); } return null; }
private static Credentials extractCredentials(ClientRequestContext request, Type type) { String usernameKey = null; String passwordKey = null; if (type == null) { usernameKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_USERNAME; passwordKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_PASSWORD; } else if (type == Type.BASIC) { usernameKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_BASIC_USERNAME; passwordKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_BASIC_PASSWORD; } else if (type == Type.DIGEST) { usernameKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_DIGEST_USERNAME; passwordKey = HttpAuthenticationFeature.HTTP_AUTHENTICATION_DIGEST_PASSWORD; } String userName = (String) request.getProperty(usernameKey); if (userName != null && !userName.equals("")) { byte[] pwdBytes; Object password = request.getProperty(passwordKey); if (password instanceof byte[]) { pwdBytes = ((byte[]) password); } else if (password instanceof String) { pwdBytes = ((String) password).getBytes(CHARACTER_SET); } else { throw new RequestAuthenticationException( LocalizationMessages.AUTHENTICATION_CREDENTIALS_REQUEST_PASSWORD_UNSUPPORTED()); } return new Credentials(userName, pwdBytes); } return null; }
@Override public HttpAuthenticationFeature build() { return new HttpAuthenticationFeature(mode, usernameBasic == null ? null : new HttpAuthenticationFilter.Credentials(usernameBasic, passwordBasic), usernameDigest == null ? null : new HttpAuthenticationFilter.Credentials(usernameDigest, passwordDigest)); }
@Override public HttpAuthenticationFeature build() { return new HttpAuthenticationFeature(mode, usernameBasic == null ? null : new HttpAuthenticationFilter.Credentials(usernameBasic, passwordBasic), usernameDigest == null ? null : new HttpAuthenticationFilter.Credentials(usernameDigest, passwordDigest)); }
@Override public HttpAuthenticationFeature build() { return new HttpAuthenticationFeature(mode, usernameBasic == null ? null : new HttpAuthenticationFilter.Credentials(usernameBasic, passwordBasic), usernameDigest == null ? null : new HttpAuthenticationFilter.Credentials(usernameDigest, passwordDigest)); }
@Override public HttpAuthenticationFeature build() { return new HttpAuthenticationFeature(mode, usernameBasic == null ? null : new HttpAuthenticationFilter.Credentials(usernameBasic, passwordBasic), usernameDigest == null ? null : new HttpAuthenticationFilter.Credentials(usernameDigest, passwordDigest)); }
@Override public HttpAuthenticationFeature build() { return new HttpAuthenticationFeature(mode, usernameBasic == null ? null : new HttpAuthenticationFilter.Credentials(usernameBasic, passwordBasic), usernameDigest == null ? null : new HttpAuthenticationFilter.Credentials(usernameDigest, passwordDigest)); }
@Override public HttpAuthenticationFeature build() { return new HttpAuthenticationFeature(mode, usernameBasic == null ? null : new HttpAuthenticationFilter.Credentials(usernameBasic, passwordBasic), usernameDigest == null ? null : new HttpAuthenticationFilter.Credentials(usernameDigest, passwordDigest)); }
@Override public HttpAuthenticationFeature build() { return new HttpAuthenticationFeature(mode, usernameBasic == null ? null : new HttpAuthenticationFilter.Credentials(usernameBasic, passwordBasic), usernameDigest == null ? null : new HttpAuthenticationFilter.Credentials(usernameDigest, passwordDigest)); }