This content has been marked as final.
Show 4 replies
-
1. Re: Can't inject into an Entity Bean...
tony.herstell1 Jan 25, 2007 5:13 PM (in response to tony.herstell1)Moving it outside does not MAKE the key over 15 chars... you know what I am getting at though.
-
2. Re: Can't inject into an Entity Bean...
gavin.king Jan 25, 2007 5:42 PM (in response to tony.herstell1)You can use Component.getInstance().
-
3. Re: Can't inject into an Entity Bean...
tony.herstell1 Jan 25, 2007 6:17 PM (in response to tony.herstell1)"gavin.king@jboss.com" wrote:
You can use Component.getInstance().
Thanks:/* Really this should to be 15; it was extended to allow for the crypt to take place! * A bad side effect is the GUI is now allowing upto 50 length. * This routine will still fail if you put a password in of close to 50 length as the crypt is longer that 50. * This really is an Aspect on the set/get Password! - ToDo */ @NotNull(message="required") @Length(min = 5, max = 50) public String getPassword() { String theValueToReturn = null; if (password != null) { EncryptionController anEncryptionController = (EncryptionController) Component.getInstance("encryptionController", true); theValueToReturn = anEncryptionController.decrypt(password); } return theValueToReturn; } public void setPassword(String password) { if (password != null) { EncryptionController anEncryptionController = (EncryptionController) Component.getInstance("encryptionController", true); this.password = anEncryptionController.encrypt(password); } else { this.password = null; } } @NotNull(message="required") @Length(min = 5, max = 15) @Pattern(regex = "^\\w*$") public String getUsername() { return username; }
-
4. Re: Can't inject into an Entity Bean...
tony.herstell1 Jan 25, 2007 9:26 PM (in response to tony.herstell1)Be wary of this method as you are talking to the database "through" the entity bean.
So when the persistence implementation is putting and getting it is also crypting/decrypting.
You end up having two crpyts or a double decrypt going on quite quickly and you fix it for a read from the database only to have it fail for a pure "create" call coming from your business logic.
So, I have moved the crypt/decrypt into the business logic.
:/