Skip to content

Commit 9a7f1aa

Browse files
committed
Add ClientAuthenticationMethod constants tls_client_auth and self_signed_tls_client_auth
Closes gh-14889
1 parent 644cfa9 commit 9a7f1aa

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/ClientAuthenticationMethod.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -62,6 +62,17 @@ public final class ClientAuthenticationMethod implements Serializable {
6262
*/
6363
public static final ClientAuthenticationMethod NONE = new ClientAuthenticationMethod("none");
6464

65+
/**
66+
* @since 6.3
67+
*/
68+
public static final ClientAuthenticationMethod TLS_CLIENT_AUTH = new ClientAuthenticationMethod("tls_client_auth");
69+
70+
/**
71+
* @since 6.3
72+
*/
73+
public static final ClientAuthenticationMethod SELF_SIGNED_TLS_CLIENT_AUTH = new ClientAuthenticationMethod(
74+
"self_signed_tls_client_auth");
75+
6576
private final String value;
6677

6778
/**

oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/ClientAuthenticationMethodTests.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -58,4 +58,15 @@ public void getValueWhenAuthenticationMethodNoneThenReturnNone() {
5858
assertThat(ClientAuthenticationMethod.NONE.getValue()).isEqualTo("none");
5959
}
6060

61+
@Test
62+
public void getValueWhenAuthenticationMethodTlsClientAuthThenReturnTlsClientAuth() {
63+
assertThat(ClientAuthenticationMethod.TLS_CLIENT_AUTH.getValue()).isEqualTo("tls_client_auth");
64+
}
65+
66+
@Test
67+
public void getValueWhenAuthenticationMethodSelfSignedTlsClientAuthThenReturnSelfSignedTlsClientAuth() {
68+
assertThat(ClientAuthenticationMethod.SELF_SIGNED_TLS_CLIENT_AUTH.getValue())
69+
.isEqualTo("self_signed_tls_client_auth");
70+
}
71+
6172
}

0 commit comments

Comments
 (0)