public final class NSALoginController
extends java.lang.Object
User
class.
It contains only static methods, and therefore maintains no state.
Another example of a class containing only static methods is
Java's built-in Math
class.
Notice the interesting formatting used in this comment block. This special formatting is called Javadocs and is used by Java IDEs to automatically generate documentation for classes.
Many Java IDEs will help you automatically generate the formatting for the Javadoc comments.
Javadocs are widely used in industry, and if you work for a company that uses Java code, you will almost certainly be expected to include Javadocs in your own code, so it's a good habit to develop.
You can use the javadoc
tool to generate fancy HTML files. For example:
javadoc *.java -d ./doc
Then you can open the index.html file in the doc directory.
For more information about how to write javadocs see:
For more information about when to write javadocs see these Stack Overflow posts:
Modifier and Type | Method and Description |
---|---|
static void |
hashUserPassword(User user)
This function takes the password from the
User class and hashes it. |
static java.lang.Boolean |
verifyPassword(User user)
This function uses the password and salt in the
User to generate a hash,
then compares that hash to the original hash value. |
public static void hashUserPassword(User user) throws java.lang.Exception
User
class and hashes it.
As a side-effect, the original password value is removed for security purposes.user
- The user whose password needs to be hashed.java.lang.Exception
- If there is a problem with the chosen hash function.public static java.lang.Boolean verifyPassword(User user) throws java.lang.Exception
User
to generate a hash,
then compares that hash to the original hash value.user
- The user whose password needs to be hashed.java.lang.Exception
- If there is a problem with the chosen hash function.