Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(multiple-auth): add support for multiple auth #51

Merged
merged 7 commits into from
Dec 4, 2023
Merged
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,39 @@
/**
* To setup methods for authentication
*/
public interface Authentication {
public abstract class Authentication {

/**
* Apply the authentication on the httpRequest
* @param httpRequest the request on which authentication is being applied
* @return the authenticated request
* Stores the error message for the auth scheme.
*/
Request apply(Request httpRequest);
private String errorMessage;

/**
* Validates the auth params for the httpRequest
* Applies the authentication on the httpRequest.
* @param httpRequest the request on which authentication is being applied.
* @return the authenticated request.
*/
void validate();
public abstract Request apply(Request httpRequest);

/**
* Validates the credentials for authentication.
* @return true if the auth credentials are valid, false otherwise.
*/
public abstract boolean validate();

/**
* Returns the error message if the auth credentials are not valid.
* @return The string message whenever the auth credentials are not valid.
*/
public String getErrorMessage() {
return errorMessage;
}

/**
* Sets the error message for invalid auth credentials.
* @param errorMessage the error message to set.
*/
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
}
Loading