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

Add AuthenticationRedirectException and AuthenticationCompletionException #10

Merged
merged 1 commit into from
Sep 16, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
@@ -0,0 +1,27 @@
package io.quarkus.security;

/**
* Exception indicating that a user authentication flow has failed and no challenge is required.
*
* For example, it can be used to avoid the redirect loops during an OpenId Connect authorization code flow
* after the user has already authenticated at the IDP site but a state parameter is not available after
* a redirect back to the Quarkus endpoint or if the code flow can not be completed for some other reasons.
*/
public class AuthenticationCompletionException extends RuntimeException {

public AuthenticationCompletionException() {

}

public AuthenticationCompletionException(String errorMessage) {
this(errorMessage, null);
}

public AuthenticationCompletionException(Throwable cause) {
this(null, cause);
}

public AuthenticationCompletionException(String errorMessage, Throwable cause) {
super(errorMessage, cause);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package io.quarkus.security;

/**
* Exception indicating that a redirect is required for the authentication flow to complete.
*
* For example, it can be used during an OpenId Connect authorization code flow to redirect
* the user to the original request URI which was used before the authorization code flow has started.
*/
public class AuthenticationRedirectException extends RuntimeException {

final int code;
final String redirectUri;

public AuthenticationRedirectException(String redirectUri) {
this(302, redirectUri);
}

public AuthenticationRedirectException(int code, String redirectUri) {
this.code = code;
this.redirectUri = redirectUri;
}

public int getCode() {
return this.code;
}

public String getRedirectUri() {
return redirectUri;
}
}