Skip to content

Commit 2c7a686

Browse files
authored
Merge pull request #26 from FusionAuth/rob/issue-1206
issue-1206
2 parents 8bdd402 + b9dcda0 commit 2c7a686

File tree

2 files changed

+43
-7
lines changed

2 files changed

+43
-7
lines changed

src/main/java/io/fusionauth/domain/provider/NintendoApplicationConfiguration.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, FusionAuth, All Rights Reserved
2+
* Copyright (c) 2018-2022, FusionAuth, All Rights Reserved
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.
@@ -34,9 +34,18 @@ public class NintendoApplicationConfiguration extends BaseIdentityProviderApplic
3434
@InternalJSONColumn
3535
public String client_secret;
3636

37+
@InternalJSONColumn
38+
public String emailClaim = "email";
39+
3740
@InternalJSONColumn
3841
public String scope;
3942

43+
@InternalJSONColumn
44+
public String uniqueIdClaim = "id";
45+
46+
@InternalJSONColumn
47+
public String usernameClaim = "preferred_username";
48+
4049
@Override
4150
public boolean equals(Object o) {
4251
if (this == o) {
@@ -52,12 +61,15 @@ public boolean equals(Object o) {
5261
return Objects.equals(buttonText, that.buttonText) &&
5362
Objects.equals(client_id, that.client_id) &&
5463
Objects.equals(client_secret, that.client_secret) &&
55-
Objects.equals(scope, that.scope);
64+
Objects.equals(scope, that.scope) &&
65+
Objects.equals(uniqueIdClaim, that.uniqueIdClaim) &&
66+
Objects.equals(emailClaim, that.emailClaim) &&
67+
Objects.equals(usernameClaim, that.usernameClaim);
5668
}
5769

5870
@Override
5971
public int hashCode() {
60-
return Objects.hash(super.hashCode(), buttonText, client_id, client_secret, scope);
72+
return Objects.hash(super.hashCode(), buttonText, client_id, client_secret, scope, uniqueIdClaim, emailClaim, usernameClaim);
6173
}
6274

6375
@Override

src/main/java/io/fusionauth/domain/provider/NintendoIdentityProvider.java

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, FusionAuth, All Rights Reserved
2+
* Copyright (c) 2021-2022, FusionAuth, All Rights Reserved
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.
@@ -37,9 +37,18 @@ public class NintendoIdentityProvider extends BaseIdentityProvider<NintendoAppli
3737
@InternalJSONColumn
3838
public String client_secret;
3939

40+
@InternalJSONColumn
41+
public String emailClaim = "email";
42+
4043
@InternalJSONColumn
4144
public String scope;
4245

46+
@InternalJSONColumn
47+
public String uniqueIdClaim = "id";
48+
49+
@InternalJSONColumn
50+
public String usernameClaim = "preferred_username";
51+
4352
public NintendoIdentityProvider() {
4453
linkingStrategy = IdentityProviderLinkingStrategy.CreatePendingLink;
4554
}
@@ -49,7 +58,7 @@ public boolean equals(Object o) {
4958
if (this == o) {
5059
return true;
5160
}
52-
if (!(o instanceof NintendoIdentityProvider)) {
61+
if (o == null || getClass() != o.getClass()) {
5362
return false;
5463
}
5564
if (!super.equals(o)) {
@@ -59,7 +68,10 @@ public boolean equals(Object o) {
5968
return Objects.equals(buttonText, that.buttonText) &&
6069
Objects.equals(client_id, that.client_id) &&
6170
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);
6375
}
6476

6577
@Override
@@ -69,7 +81,7 @@ public IdentityProviderType getType() {
6981

7082
@Override
7183
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);
7385
}
7486

7587
public String lookupButtonText(String clientId) {
@@ -88,10 +100,22 @@ public String lookupClientSecret(UUID applicationId) {
88100
return lookup(() -> client_secret, () -> app(applicationId, app -> app.client_secret));
89101
}
90102

103+
public String lookupEmailClaim(UUID applicationId) {
104+
return lookup(() -> emailClaim, () -> app(emailClaim, app -> app.emailClaim));
105+
}
106+
91107
public String lookupScope(String clientId) {
92108
return lookup(() -> scope, () -> app(clientId, app -> app.scope));
93109
}
94110

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+
95119
@Override
96120
public boolean postRequestEnabled() {
97121
return false;

0 commit comments

Comments
 (0)