From 61550f8a480059d6eec999852ca8edba0c179aa0 Mon Sep 17 00:00:00 2001 From: Joe Grandja Date: Wed, 4 Nov 2020 13:17:06 -0500 Subject: [PATCH] Add convenience constructor in OAuth2AuthenticationException Closes gh-9190 --- .../oauth2/core/OAuth2AuthenticationException.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/OAuth2AuthenticationException.java b/oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/OAuth2AuthenticationException.java index 01cedf36e1..a868f3180d 100644 --- a/oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/OAuth2AuthenticationException.java +++ b/oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/OAuth2AuthenticationException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,6 +43,15 @@ public class OAuth2AuthenticationException extends AuthenticationException { private final OAuth2Error error; + /** + * Constructs an {@code OAuth2AuthenticationException} using the provided parameters. + * @param errorCode the {@link OAuth2ErrorCodes OAuth 2.0 Error Code} + * @since 5.5 + */ + public OAuth2AuthenticationException(String errorCode) { + this(new OAuth2Error(errorCode)); + } + /** * Constructs an {@code OAuth2AuthenticationException} using the provided parameters. * @param error the {@link OAuth2Error OAuth 2.0 Error}