SEC-1794: Convert OpenIDAuthenticationStatus to an enum.
This commit is contained in:
parent
0c2a950fa0
commit
0120643721
|
@ -14,42 +14,31 @@
|
||||||
*/
|
*/
|
||||||
package org.springframework.security.openid;
|
package org.springframework.security.openid;
|
||||||
|
|
||||||
import java.io.ObjectStreamException;
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Based on JanRain status codes
|
* Authentication status codes, based on JanRain status codes
|
||||||
*
|
*
|
||||||
* @author JanRain Inc.
|
* @author JanRain Inc.
|
||||||
* @author Robin Bramley, Opsera Ltd
|
* @author Robin Bramley, Opsera Ltd
|
||||||
|
* @author Luke Taylor
|
||||||
*/
|
*/
|
||||||
public class OpenIDAuthenticationStatus implements Serializable {
|
public enum OpenIDAuthenticationStatus {
|
||||||
//~ Static fields/initializers =====================================================================================
|
|
||||||
|
|
||||||
private static final long serialVersionUID = -998877665544332211L;
|
|
||||||
private static int nextOrdinal = 0;
|
|
||||||
|
|
||||||
/** This code indicates a successful authentication request */
|
/** This code indicates a successful authentication request */
|
||||||
public static final OpenIDAuthenticationStatus SUCCESS = new OpenIDAuthenticationStatus("success");
|
SUCCESS("success"),
|
||||||
|
|
||||||
/** This code indicates a failed authentication request */
|
/** This code indicates a failed authentication request */
|
||||||
public static final OpenIDAuthenticationStatus FAILURE = new OpenIDAuthenticationStatus("failure");
|
FAILURE("failure"),
|
||||||
|
|
||||||
/** This code indicates the server reported an error */
|
/** This code indicates the server reported an error */
|
||||||
public static final OpenIDAuthenticationStatus ERROR = new OpenIDAuthenticationStatus("error");
|
ERROR("error"),
|
||||||
|
|
||||||
/** This code indicates that the user needs to do additional work to prove their identity */
|
/** This code indicates that the user needs to do additional work to prove their identity */
|
||||||
public static final OpenIDAuthenticationStatus SETUP_NEEDED = new OpenIDAuthenticationStatus("setup needed");
|
SETUP_NEEDED("setup needed"),
|
||||||
|
|
||||||
/** This code indicates that the user cancelled their login request */
|
/** This code indicates that the user cancelled their login request */
|
||||||
public static final OpenIDAuthenticationStatus CANCELLED = new OpenIDAuthenticationStatus("cancelled");
|
CANCELLED("cancelled");
|
||||||
private static final OpenIDAuthenticationStatus[] PRIVATE_VALUES = {SUCCESS, FAILURE, ERROR, SETUP_NEEDED, CANCELLED};
|
|
||||||
|
|
||||||
//~ Instance fields ================================================================================================
|
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private final int ordinal = nextOrdinal++;
|
|
||||||
|
|
||||||
//~ Constructors ===================================================================================================
|
//~ Constructors ===================================================================================================
|
||||||
|
|
||||||
|
@ -57,12 +46,6 @@ public class OpenIDAuthenticationStatus implements Serializable {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
//~ Methods ========================================================================================================
|
|
||||||
|
|
||||||
private Object readResolve() throws ObjectStreamException {
|
|
||||||
return PRIVATE_VALUES[ordinal];
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue