The following document contains the results of PMD's CPD 4.1.
| File | Line |
|---|---|
| com\gridsystems\innergrid\kernel\examples\dummy\DummyAAService.java | 52 |
| com\gridsystems\innergrid\kernel\simplemonitor\SimpleMonitorAAService.java | 53 |
public SimpleMonitorAAService() { }
/**
* {@inheritDoc}
*/
public boolean canImpersonate(String userName) {
return true;
}
/**
* {@inheritDoc}
*/
public void authorize(String service, String method) {
String userName = KernelContext.getContext().getEffectiveUser();
StringTokenizer st = new StringTokenizer(userName, "_");
String language = st.hasMoreTokens() ? st.nextToken() : "";
String country = st.hasMoreTokens() ? st.nextToken() : "";
String variant = st.hasMoreTokens() ? st.nextToken() : "";
if (language.length() > 2) {
language = language.substring(0, 2);
}
language = language.toLowerCase();
if (country.length() > 2) {
country = country.substring(0, 2);
}
country = country.toUpperCase();
Locale locale = new Locale(language, country, variant);
KernelContext.getContext().setLocale(locale);
}
/**
* {@inheritDoc}
*/
public CallbackHandler getPasswordCallbackHandler() {
return this;
}
/**
* Handles UserNameToken credentials in the WSS4J framework.
*
* {@inheritDoc}
*/
public void handle(Callback[] callbacks) throws UnsupportedCallbackException {
for (int i = 0; i < callbacks.length; i++) {
if (callbacks[i] instanceof WSPasswordCallback) {
WSPasswordCallback pc = (WSPasswordCallback) callbacks[i];
switch (pc.getUsage()) {
case WSPasswordCallback.USERNAME_TOKEN:
pc.setPassword("");
break;
case WSPasswordCallback.KEY_NAME:
case WSPasswordCallback.SIGNATURE:
case WSPasswordCallback.UNKNOWN:
default:
throw new UnsupportedCallbackException(callbacks[i], "Unsupported usage");
}
} else {
throw new UnsupportedCallbackException(callbacks[i], "Unrecognized Callback");
}
}
}
/**
* {@inheritDoc}
*/
public int[] getSupportedTokens() {
return new int[] {
WSPasswordCallback.USERNAME_TOKEN
};
}
/**
* {@inheritDoc}
*/
public boolean createDefaultAcl(AuthACL acl) {
return true;
}
/**
* {@inheritDoc}
*/
public boolean isUserInRole(String roleName) {
return true;
}
/**
* {@inheritDoc}
*/
public String getAdminRoleName() {
return "*";
}
/**
* {@inheritDoc}
*/
public Object doPrivileged(PrivilegedAction action) throws KernelException {
| |