|
5 | 5 | /** |
6 | 6 | * To setup methods for authentication |
7 | 7 | */ |
8 | | -public abstract class Authentication { |
| 8 | +public interface Authentication { |
9 | 9 |
|
10 | 10 | /** |
11 | | - * Stores the validity of the auth scheme. |
| 11 | + * Apply the authentication on the httpRequest |
| 12 | + * @param httpRequest the request on which authentication is being applied |
| 13 | + * @return the authenticated request |
12 | 14 | */ |
13 | | - private boolean isValid; |
| 15 | + Request apply(Request httpRequest); |
14 | 16 |
|
15 | 17 | /** |
16 | | - * Stores the error message for the auth scheme. |
| 18 | + * Validates the auth params for the httpRequest |
17 | 19 | */ |
18 | | - private String errorMessage; |
19 | | - |
20 | | - /** |
21 | | - * Applies the authentication on the httpRequest. |
22 | | - * @param httpRequest the request on which authentication is being applied. |
23 | | - * @return the authenticated request. |
24 | | - */ |
25 | | - public abstract Request apply(Request httpRequest); |
26 | | - |
27 | | - /** |
28 | | - * Validates the credentials for authentication. |
29 | | - */ |
30 | | - public abstract void validate(); |
31 | | - |
32 | | - /** |
33 | | - * Checks if the auth credentials are valid. |
34 | | - * @return true if the auth credentials are valid, false otherwise. |
35 | | - */ |
36 | | - public boolean isValid() { |
37 | | - return isValid; |
38 | | - } |
39 | | - |
40 | | - /** |
41 | | - * Sets the validatity of the auth credentials. |
42 | | - * @param isValid the flag to set for validity. |
43 | | - */ |
44 | | - public void setValidity(boolean isValid) { |
45 | | - this.isValid = isValid; |
46 | | - } |
47 | | - |
48 | | - /** |
49 | | - * Returns the error message if the auth credentials are not valid. |
50 | | - * @return the string message whenever the auth credentials are not valid. |
51 | | - */ |
52 | | - public String getErrorMessage() { |
53 | | - return errorMessage; |
54 | | - } |
55 | | - |
56 | | - /** |
57 | | - * Sets the error message for invalid auth credentials. |
58 | | - * @param errorMessage the error message to set. |
59 | | - */ |
60 | | - public void setErrorMessage(String errorMessage) { |
61 | | - this.errorMessage = errorMessage; |
62 | | - } |
| 20 | + void validate(); |
63 | 21 | } |
0 commit comments