Mercurial Hosting > luan
comparison src/org/eclipse/jetty/server/Authentication.java @ 813:f8f7cb485c25
remove UserIdentity
| author | Franklin Schmidt <fschmidt@gmail.com> |
|---|---|
| date | Thu, 08 Sep 2016 22:01:33 -0600 |
| parents | 3428c60d7cfc |
| children |
comparison
equal
deleted
inserted
replaced
| 812:700317ba03ad | 813:f8f7cb485c25 |
|---|---|
| 33 * and failed, checked and deferred or succeeded. | 33 * and failed, checked and deferred or succeeded. |
| 34 * | 34 * |
| 35 */ | 35 */ |
| 36 public interface Authentication | 36 public interface Authentication |
| 37 { | 37 { |
| 38 /* ------------------------------------------------------------ */ | 38 /* ------------------------------------------------------------ */ |
| 39 /** A successful Authentication with User information. | 39 /** A successful Authentication with User information. |
| 40 */ | 40 */ |
| 41 public interface User extends Authentication | 41 public interface User extends Authentication |
| 42 { | 42 { |
| 43 String getAuthMethod(); | 43 String getAuthMethod(); |
| 44 UserIdentity getUserIdentity(); | 44 void logout(); |
| 45 boolean isUserInRole(UserIdentity.Scope scope,String role); | 45 } |
| 46 void logout(); | 46 |
| 47 } | 47 /* ------------------------------------------------------------ */ |
| 48 | 48 /** A wrapped authentication with methods provide the |
| 49 /* ------------------------------------------------------------ */ | 49 * wrapped request/response for use by the application |
| 50 /** A wrapped authentication with methods provide the | 50 */ |
| 51 * wrapped request/response for use by the application | 51 public interface Wrapped extends Authentication |
| 52 */ | 52 { |
| 53 public interface Wrapped extends Authentication | 53 HttpServletRequest getHttpServletRequest(); |
| 54 { | 54 HttpServletResponse getHttpServletResponse(); |
| 55 HttpServletRequest getHttpServletRequest(); | 55 } |
| 56 HttpServletResponse getHttpServletResponse(); | 56 |
| 57 } | 57 /* ------------------------------------------------------------ */ |
| 58 | 58 /** A deferred authentication with methods to progress |
| 59 /* ------------------------------------------------------------ */ | 59 * the authentication process. |
| 60 /** A deferred authentication with methods to progress | 60 */ |
| 61 * the authentication process. | 61 public interface Deferred extends Authentication |
| 62 */ | 62 { |
| 63 public interface Deferred extends Authentication | 63 /* ------------------------------------------------------------ */ |
| 64 { | 64 /** Authenticate if possible without sending a challenge. |
| 65 /* ------------------------------------------------------------ */ | 65 * This is used to check credentials that have been sent for |
| 66 /** Authenticate if possible without sending a challenge. | 66 * non-manditory authentication. |
| 67 * This is used to check credentials that have been sent for | 67 * @return The new Authentication state. |
| 68 * non-manditory authentication. | 68 */ |
| 69 * @return The new Authentication state. | 69 Authentication authenticate(ServletRequest request); |
| 70 */ | |
| 71 Authentication authenticate(ServletRequest request); | |
| 72 | 70 |
| 73 /* ------------------------------------------------------------ */ | 71 /* ------------------------------------------------------------ */ |
| 74 /** Authenticate and possibly send a challenge. | 72 /** Authenticate and possibly send a challenge. |
| 75 * This is used to initiate authentication for previously | 73 * This is used to initiate authentication for previously |
| 76 * non-manditory authentication. | 74 * non-manditory authentication. |
| 77 * @return The new Authentication state. | 75 * @return The new Authentication state. |
| 78 */ | 76 */ |
| 79 Authentication authenticate(ServletRequest request,ServletResponse response); | 77 Authentication authenticate(ServletRequest request,ServletResponse response); |
| 80 | 78 |
| 81 | 79 |
| 82 /* ------------------------------------------------------------ */ | 80 /* ------------------------------------------------------------ */ |
| 83 /** Login with the LOGIN authenticator | 81 /** Login with the LOGIN authenticator |
| 84 * @param username | 82 * @param username |
| 85 * @param password | 83 * @param password |
| 86 * @return The new Authentication state | 84 * @return The new Authentication state |
| 87 */ | 85 */ |
| 88 Authentication login(String username,Object password,ServletRequest request); | 86 Authentication login(String username,Object password,ServletRequest request); |
| 89 } | 87 } |
| 90 | 88 |
| 91 | 89 |
| 92 /* ------------------------------------------------------------ */ | 90 /* ------------------------------------------------------------ */ |
| 93 /** Authentication Response sent state. | 91 /** Authentication Response sent state. |
| 94 * Responses are sent by authenticators either to issue an | 92 * Responses are sent by authenticators either to issue an |
| 95 * authentication challenge or on successful authentication in | 93 * authentication challenge or on successful authentication in |
| 96 * order to redirect the user to the original URL. | 94 * order to redirect the user to the original URL. |
| 97 */ | 95 */ |
| 98 public interface ResponseSent extends Authentication | 96 public interface ResponseSent extends Authentication |
| 99 { | 97 { |
| 100 } | 98 } |
| 101 | 99 |
| 102 /* ------------------------------------------------------------ */ | 100 /* ------------------------------------------------------------ */ |
| 103 /** An Authentication Challenge has been sent. | 101 /** An Authentication Challenge has been sent. |
| 104 */ | 102 */ |
| 105 public interface Challenge extends ResponseSent | 103 public interface Challenge extends ResponseSent |
| 106 { | 104 { |
| 107 } | 105 } |
| 108 | 106 |
| 109 /* ------------------------------------------------------------ */ | 107 /* ------------------------------------------------------------ */ |
| 110 /** An Authentication Failure has been sent. | 108 /** An Authentication Failure has been sent. |
| 111 */ | 109 */ |
| 112 public interface Failure extends ResponseSent | 110 public interface Failure extends ResponseSent |
| 113 { | 111 { |
| 114 } | 112 } |
| 115 | 113 |
| 116 public interface SendSuccess extends ResponseSent | 114 public interface SendSuccess extends ResponseSent |
| 117 { | 115 { |
| 118 } | 116 } |
| 119 | 117 |
| 120 /* ------------------------------------------------------------ */ | 118 /* ------------------------------------------------------------ */ |
| 121 /** Unauthenticated state. | 119 /** Unauthenticated state. |
| 122 * <p> | 120 * <p> |
| 123 * This convenience instance is for non mandatory authentication where credentials | 121 * This convenience instance is for non mandatory authentication where credentials |
| 124 * have been presented and checked, but failed authentication. | 122 * have been presented and checked, but failed authentication. |
| 125 */ | 123 */ |
| 126 public final static Authentication UNAUTHENTICATED = new Authentication(){@Override | 124 public final static Authentication UNAUTHENTICATED = new Authentication(){@Override |
| 127 public String toString(){return "UNAUTHENTICATED";}}; | 125 public String toString(){return "UNAUTHENTICATED";}}; |
| 128 | 126 |
| 129 /* ------------------------------------------------------------ */ | 127 /* ------------------------------------------------------------ */ |
| 130 /** Authentication not checked | 128 /** Authentication not checked |
| 131 * <p> | 129 * <p> |
| 132 * This convenience instance us for non mandatory authentication when no | 130 * This convenience instance us for non mandatory authentication when no |
| 133 * credentials are present to be checked. | 131 * credentials are present to be checked. |
| 134 */ | 132 */ |
| 135 public final static Authentication NOT_CHECKED = new Authentication(){@Override | 133 public final static Authentication NOT_CHECKED = new Authentication(){@Override |
| 136 public String toString(){return "NOT CHECKED";}}; | 134 public String toString(){return "NOT CHECKED";}}; |
| 137 | 135 |
| 138 /* ------------------------------------------------------------ */ | 136 /* ------------------------------------------------------------ */ |
| 139 /** Authentication challenge sent. | 137 /** Authentication challenge sent. |
| 140 * <p> | 138 * <p> |
| 141 * This convenience instance is for when an authentication challenge has been sent. | 139 * This convenience instance is for when an authentication challenge has been sent. |
| 142 */ | 140 */ |
| 143 public final static Authentication SEND_CONTINUE = new Authentication.Challenge(){@Override | 141 public final static Authentication SEND_CONTINUE = new Authentication.Challenge(){@Override |
| 144 public String toString(){return "CHALLENGE";}}; | 142 public String toString(){return "CHALLENGE";}}; |
| 145 | 143 |
| 146 /* ------------------------------------------------------------ */ | 144 /* ------------------------------------------------------------ */ |
| 147 /** Authentication failure sent. | 145 /** Authentication failure sent. |
| 148 * <p> | 146 * <p> |
| 149 * This convenience instance is for when an authentication failure has been sent. | 147 * This convenience instance is for when an authentication failure has been sent. |
| 150 */ | 148 */ |
| 151 public final static Authentication SEND_FAILURE = new Authentication.Failure(){@Override | 149 public final static Authentication SEND_FAILURE = new Authentication.Failure(){@Override |
| 152 public String toString(){return "FAILURE";}}; | 150 public String toString(){return "FAILURE";}}; |
| 153 public final static Authentication SEND_SUCCESS = new SendSuccess(){@Override | 151 public final static Authentication SEND_SUCCESS = new SendSuccess(){@Override |
| 154 public String toString(){return "SEND_SUCCESS";}}; | 152 public String toString(){return "SEND_SUCCESS";}}; |
| 155 } | 153 } |
