Skip to content

Instantly share code, notes, and snippets.

@eivinhb
Created May 24, 2012 08:27
Show Gist options
  • Save eivinhb/2780209 to your computer and use it in GitHub Desktop.
Save eivinhb/2780209 to your computer and use it in GitHub Desktop.
Code for use in a blogg
public class SecureKeyGenerator implements KeyGenerator {
@Override
public Object generate(Object target, Method method, Object... params) {
Object keyPostFix = new DefaultKeyGenerator().generate(target, method, params);
if (target instanceof SecureKeyAware && ((SecureAware) target).getSecureKey() != null) {
return ((SecureKeyAware) target).getSecureKey() + keyPostFix;
} else {
throw new RuntimeExeption("Target for key generation is not secure key aware.");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment