Created
May 24, 2012 08:27
-
-
Save eivinhb/2780209 to your computer and use it in GitHub Desktop.
Code for use in a blogg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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