1
1
/*
2
- * Copyright (c) 2021, FusionAuth, All Rights Reserved
2
+ * Copyright (c) 2021-2022 , FusionAuth, All Rights Reserved
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -37,9 +37,18 @@ public class NintendoIdentityProvider extends BaseIdentityProvider<NintendoAppli
37
37
@ InternalJSONColumn
38
38
public String client_secret ;
39
39
40
+ @ InternalJSONColumn
41
+ public String emailClaim = "email" ;
42
+
40
43
@ InternalJSONColumn
41
44
public String scope ;
42
45
46
+ @ InternalJSONColumn
47
+ public String uniqueIdClaim = "id" ;
48
+
49
+ @ InternalJSONColumn
50
+ public String usernameClaim = "preferred_username" ;
51
+
43
52
public NintendoIdentityProvider () {
44
53
linkingStrategy = IdentityProviderLinkingStrategy .CreatePendingLink ;
45
54
}
@@ -49,7 +58,7 @@ public boolean equals(Object o) {
49
58
if (this == o ) {
50
59
return true ;
51
60
}
52
- if (!( o instanceof NintendoIdentityProvider )) {
61
+ if (o == null || getClass () != o . getClass ( )) {
53
62
return false ;
54
63
}
55
64
if (!super .equals (o )) {
@@ -59,7 +68,10 @@ public boolean equals(Object o) {
59
68
return Objects .equals (buttonText , that .buttonText ) &&
60
69
Objects .equals (client_id , that .client_id ) &&
61
70
Objects .equals (client_secret , that .client_secret ) &&
62
- Objects .equals (scope , that .scope );
71
+ Objects .equals (emailClaim , that .emailClaim ) &&
72
+ Objects .equals (scope , that .scope ) &&
73
+ Objects .equals (uniqueIdClaim , that .uniqueIdClaim ) &&
74
+ Objects .equals (usernameClaim , that .usernameClaim );
63
75
}
64
76
65
77
@ Override
@@ -69,7 +81,7 @@ public IdentityProviderType getType() {
69
81
70
82
@ Override
71
83
public int hashCode () {
72
- return Objects .hash (super .hashCode (), buttonText , client_id , client_secret , scope );
84
+ return Objects .hash (super .hashCode (), buttonText , client_id , client_secret , emailClaim , scope , uniqueIdClaim , usernameClaim );
73
85
}
74
86
75
87
public String lookupButtonText (String clientId ) {
@@ -88,10 +100,22 @@ public String lookupClientSecret(UUID applicationId) {
88
100
return lookup (() -> client_secret , () -> app (applicationId , app -> app .client_secret ));
89
101
}
90
102
103
+ public String lookupEmailClaim (UUID applicationId ) {
104
+ return lookup (() -> emailClaim , () -> app (emailClaim , app -> app .emailClaim ));
105
+ }
106
+
91
107
public String lookupScope (String clientId ) {
92
108
return lookup (() -> scope , () -> app (clientId , app -> app .scope ));
93
109
}
94
110
111
+ public String lookupUniqueIdClaim (UUID applicationId ) {
112
+ return lookup (() -> uniqueIdClaim , () -> app (uniqueIdClaim , app -> app .uniqueIdClaim ));
113
+ }
114
+
115
+ public String lookupUsernameClaim (UUID applicationId ) {
116
+ return lookup (() -> usernameClaim , () -> app (usernameClaim , app -> app .usernameClaim ));
117
+ }
118
+
95
119
@ Override
96
120
public boolean postRequestEnabled () {
97
121
return false ;
0 commit comments