Java Code Examples for com.alibaba.dubbo.registry.common.domain.User#getPassword()

The following examples show how to use com.alibaba.dubbo.registry.common.domain.User#getPassword() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AuthorizationValve.java    From dubbox with Apache License 2.0 6 votes vote down vote up
private User loginByBase(String authorization) {
    authorization = Coder.decodeBase64(authorization);
    int i = authorization.indexOf(':');
    String username = authorization.substring(0, i);
    if (username != null && username.length() > 0) {
        String password = authorization.substring(i + 1);
        if (password != null && password.length() > 0) {
            String passwordDigest = Coder.encodeMd5(username + ":" + REALM + ":" + password);
            User user = getUser(username);
            if (user != null) {
                String pwd = user.getPassword();
                if (pwd != null && pwd.length() > 0) {
                    if (passwordDigest.equals(pwd)) {
                        return user;
                    }
                }
            }
        }
    }
    return null;
}
 
Example 2
Source File: AuthorizationValve.java    From dubbox-hystrix with Apache License 2.0 6 votes vote down vote up
private User loginByBase(String authorization) {
    authorization = Coder.decodeBase64(authorization);
    int i = authorization.indexOf(':');
    String username = authorization.substring(0, i);
    if (username != null && username.length() > 0) {
        String password = authorization.substring(i + 1);
        if (password != null && password.length() > 0) {
            String passwordDigest = Coder.encodeMd5(username + ":" + REALM + ":" + password);
            User user = getUser(username);
            if (user != null) {
                String pwd = user.getPassword();
                if (pwd != null && pwd.length() > 0) {
                    if (passwordDigest.equals(pwd)) {
                        return user;
                    }
                }
            }
        }
    }
    return null;
}
 
Example 3
Source File: AuthorizationValve.java    From dubbo3 with Apache License 2.0 6 votes vote down vote up
private User loginByBase(String authorization) {
    authorization = Coder.decodeBase64(authorization);
    int i = authorization.indexOf(':');
    String username = authorization.substring(0, i);
    if (username != null && username.length() > 0) {
        String password = authorization.substring(i + 1);
        if (password != null && password.length() > 0) {
            String passwordDigest = Coder.encodeMd5(username + ":" + REALM + ":" + password);
            User user = getUser(username);
            if (user != null) {
                String pwd = user.getPassword();
                if (pwd != null && pwd.length() > 0) {
                    if (passwordDigest.equals(pwd)) {
                        return user;
                    }
                }
            }
        }
    }
    return null;
}
 
Example 4
Source File: AuthorizationValve.java    From dubbox with Apache License 2.0 6 votes vote down vote up
private User loginByBase(String authorization) {
    authorization = Coder.decodeBase64(authorization);
    int i = authorization.indexOf(':');
    String username = authorization.substring(0, i);
    if (username != null && username.length() > 0) {
        String password = authorization.substring(i + 1);
        if (password != null && password.length() > 0) {
            String passwordDigest = Coder.encodeMd5(username + ":" + REALM + ":" + password);
            User user = getUser(username);
            if (user != null) {
                String pwd = user.getPassword();
                if (pwd != null && pwd.length() > 0) {
                    if (passwordDigest.equals(pwd)) {
                        return user;
                    }
                }
            }
        }
    }
    return null;
}
 
Example 5
Source File: AuthorizationValve.java    From dubbox with Apache License 2.0 6 votes vote down vote up
private User loginByBase(String authorization) {
    authorization = Coder.decodeBase64(authorization);
    int i = authorization.indexOf(':');
    String username = authorization.substring(0, i);
    if (username != null && username.length() > 0) {
        String password = authorization.substring(i + 1);
        if (password != null && password.length() > 0) {
            String passwordDigest = Coder.encodeMd5(username + ":" + REALM + ":" + password);
            User user = getUser(username);
            if (user != null) {
                String pwd = user.getPassword();
                if (pwd != null && pwd.length() > 0) {
                    if (passwordDigest.equals(pwd)) {
                        return user;
                    }
                }
            }
        }
    }
    return null;
}
 
Example 6
Source File: AuthorizationValve.java    From dubbox with Apache License 2.0 5 votes vote down vote up
private User loginByDigest(String value) throws IOException {
    Map<String, String> params = parseParameters(value);
    String username = params.get("username");
    if (username != null && username.length() > 0) {
        String passwordDigest = params.get("response");
        if (passwordDigest != null && passwordDigest.length() > 0) {
            User user = getUser(username);
            if (user != null) {
                String pwd = user.getPassword();
                // 本地User,密码本地
                if (pwd != null && pwd.length() > 0) {
                    String uri = params.get("uri");
                    String nonce = params.get("nonce");
                    String nc = params.get("nc");
                    String cnonce = params.get("cnonce");
                    String qop = params.get("qop");
                    String method = request.getMethod();
                    String a1 = pwd;

                    String a2 = "auth-int".equals(qop)
                        ? Coder.encodeMd5(method + ":" + uri + ":" + Coder.encodeMd5(readToBytes(request.getInputStream())))
                        : Coder.encodeMd5(method + ":" + uri);
                    String digest = "auth".equals(qop) || "auth-int".equals(qop)
                        ? Coder.encodeMd5(a1 + ":" + nonce + ":" + nc + ":" + cnonce + ":" + qop + ":" + a2)
                        : Coder.encodeMd5(a1 + ":" + nonce + ":" + a2);
                    if (digest.equals(passwordDigest)) {
                        return user;
                    }
                }
            }
        }
    }
    return null;
}
 
Example 7
Source File: AuthorizationValve.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
private User loginByDigest(String value) throws IOException {
    Map<String, String> params = parseParameters(value);
    String username = params.get("username");
    if (username != null && username.length() > 0) {
        String passwordDigest = params.get("response");
        if (passwordDigest != null && passwordDigest.length() > 0) {
            User user = getUser(username);
            if (user != null) {
                String pwd = user.getPassword();
                // 本地User,密码本地
                if (pwd != null && pwd.length() > 0) {
                    String uri = params.get("uri");
                    String nonce = params.get("nonce");
                    String nc = params.get("nc");
                    String cnonce = params.get("cnonce");
                    String qop = params.get("qop");
                    String method = request.getMethod();
                    String a1 = pwd;

                    String a2 = "auth-int".equals(qop)
                        ? Coder.encodeMd5(method + ":" + uri + ":" + Coder.encodeMd5(readToBytes(request.getInputStream())))
                        : Coder.encodeMd5(method + ":" + uri);
                    String digest = "auth".equals(qop) || "auth-int".equals(qop)
                        ? Coder.encodeMd5(a1 + ":" + nonce + ":" + nc + ":" + cnonce + ":" + qop + ":" + a2)
                        : Coder.encodeMd5(a1 + ":" + nonce + ":" + a2);
                    if (digest.equals(passwordDigest)) {
                        return user;
                    }
                }
            }
        }
    }
    return null;
}
 
Example 8
Source File: AuthorizationValve.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
private User loginByDigest(String value) throws IOException {
    Map<String, String> params = parseParameters(value);
    String username = params.get("username");
    if (username != null && username.length() > 0) {
        String passwordDigest = params.get("response");
        if (passwordDigest != null && passwordDigest.length() > 0) {
            User user = getUser(username);
            if (user != null) {
                String pwd = user.getPassword();
                // 本地User,密码本地
                if (pwd != null && pwd.length() > 0) {
                    String uri = params.get("uri");
                    String nonce = params.get("nonce");
                    String nc = params.get("nc");
                    String cnonce = params.get("cnonce");
                    String qop = params.get("qop");
                    String method = request.getMethod();
                    String a1 = pwd;

                    String a2 = "auth-int".equals(qop)
                        ? Coder.encodeMd5(method + ":" + uri + ":" + Coder.encodeMd5(readToBytes(request.getInputStream())))
                        : Coder.encodeMd5(method + ":" + uri);
                    String digest = "auth".equals(qop) || "auth-int".equals(qop)
                        ? Coder.encodeMd5(a1 + ":" + nonce + ":" + nc + ":" + cnonce + ":" + qop + ":" + a2)
                        : Coder.encodeMd5(a1 + ":" + nonce + ":" + a2);
                    if (digest.equals(passwordDigest)) {
                        return user;
                    }
                }
            }
        }
    }
    return null;
}
 
Example 9
Source File: AuthorizationValve.java    From dubbox with Apache License 2.0 5 votes vote down vote up
private User loginByDigest(String value) throws IOException {
    Map<String, String> params = parseParameters(value);
    String username = params.get("username");
    if (username != null && username.length() > 0) {
        String passwordDigest = params.get("response");
        if (passwordDigest != null && passwordDigest.length() > 0) {
            User user = getUser(username);
            if (user != null) {
                String pwd = user.getPassword();
                // 本地User,密码本地
                if (pwd != null && pwd.length() > 0) {
                    String uri = params.get("uri");
                    String nonce = params.get("nonce");
                    String nc = params.get("nc");
                    String cnonce = params.get("cnonce");
                    String qop = params.get("qop");
                    String method = request.getMethod();
                    String a1 = pwd;

                    String a2 = "auth-int".equals(qop)
                        ? Coder.encodeMd5(method + ":" + uri + ":" + Coder.encodeMd5(readToBytes(request.getInputStream())))
                        : Coder.encodeMd5(method + ":" + uri);
                    String digest = "auth".equals(qop) || "auth-int".equals(qop)
                        ? Coder.encodeMd5(a1 + ":" + nonce + ":" + nc + ":" + cnonce + ":" + qop + ":" + a2)
                        : Coder.encodeMd5(a1 + ":" + nonce + ":" + a2);
                    if (digest.equals(passwordDigest)) {
                        return user;
                    }
                }
            }
        }
    }
    return null;
}
 
Example 10
Source File: AuthorizationValve.java    From dubbox with Apache License 2.0 5 votes vote down vote up
private User loginByDigest(String value) throws IOException {
    Map<String, String> params = parseParameters(value);
    String username = params.get("username");
    if (username != null && username.length() > 0) {
        String passwordDigest = params.get("response");
        if (passwordDigest != null && passwordDigest.length() > 0) {
            User user = getUser(username);
            if (user != null) {
                String pwd = user.getPassword();
                // 本地User,密码本地
                if (pwd != null && pwd.length() > 0) {
                    String uri = params.get("uri");
                    String nonce = params.get("nonce");
                    String nc = params.get("nc");
                    String cnonce = params.get("cnonce");
                    String qop = params.get("qop");
                    String method = request.getMethod();
                    String a1 = pwd;

                    String a2 = "auth-int".equals(qop)
                        ? Coder.encodeMd5(method + ":" + uri + ":" + Coder.encodeMd5(readToBytes(request.getInputStream())))
                        : Coder.encodeMd5(method + ":" + uri);
                    String digest = "auth".equals(qop) || "auth-int".equals(qop)
                        ? Coder.encodeMd5(a1 + ":" + nonce + ":" + nc + ":" + cnonce + ":" + qop + ":" + a2)
                        : Coder.encodeMd5(a1 + ":" + nonce + ":" + a2);
                    if (digest.equals(passwordDigest)) {
                        return user;
                    }
                }
            }
        }
    }
    return null;
}