Skip to content
This repository was archived by the owner on Dec 12, 2018. It is now read-only.

Commit b893caa

Browse files
committed
1309: stormpath.application.name support for LocalApplication
1 parent d1d52df commit b893caa

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

extensions/servlet/src/main/java/com/stormpath/sdk/servlet/mvc/RegisterController.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,10 @@ protected ViewModel onValidSubmit(HttpServletRequest req, HttpServletResponse re
226226
value = form.getFieldValue("surname");
227227
account.setSurname(value != null ? value : "UNKNOWN");
228228

229-
account.getCustomData().putAll(getCustomData(req, form));
229+
Map<String,?> customData = getCustomData(req, form);
230+
if (customData != null && !customData.isEmpty()) {
231+
account.getCustomData().putAll(customData);
232+
}
230233

231234
//Get the Stormpath Application instance corresponding to this web app:
232235
Application app = ApplicationResolver.INSTANCE.getApplication(req);

extensions/spring/stormpath-spring/src/main/java/com/stormpath/spring/config/AbstractStormpathConfiguration.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ public abstract class AbstractStormpathConfiguration {
7070
@Value("#{ @environment['stormpath.application.href'] }")
7171
protected String applicationHref;
7272

73+
@Value("#{ @environment['stormpath.application.name'] }")
74+
protected String applicationName;
75+
7376
@Value("#{ @environment['stormpath.client.cacheManager.enabled'] ?: true }")
7477
protected boolean cachingEnabled;
7578

@@ -140,7 +143,12 @@ public Application stormpathApplication() {
140143
Client client = stormpathClient();
141144

142145
if (oktaEnabled) {
143-
return client.getResource("local", Application.class);
146+
Application application = client.getResource("local", Application.class);
147+
String name = applicationName;
148+
if (!Strings.hasText(name)) {
149+
name = "Application";
150+
}
151+
application.setName(name);
144152
}
145153

146154
if (Strings.hasText(applicationHref)) {

impl/src/main/java/com/stormpath/sdk/impl/application/LocalApplication.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ public class LocalApplication extends AbstractResource implements Application {
5454

5555
private final ApplicationAccountStoreMappingList applicationAccountStoreMappingList;
5656

57+
private String name;
58+
5759
public LocalApplication(InternalDataStore dataStore) {
5860
this(dataStore, new LinkedHashMap<String, Object>());
5961
}
@@ -114,12 +116,13 @@ public CustomData getCustomData() {
114116

115117
@Override
116118
public String getName() {
117-
throw new UnsupportedOperationException("getName() method hasn't been implemented.");
119+
return this.name;
118120
}
119121

120122
@Override
121123
public Application setName(String name) {
122-
throw new UnsupportedOperationException("setName() method hasn't been implemented.");
124+
this.name = name;
125+
return this;
123126
}
124127

125128
@Override

0 commit comments

Comments
 (0)