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

Issue 1256 mobile callback webconfig #1300

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,13 @@ public interface ApplicationWebConfig extends Resource, Saveable, Auditable {
*/
ChangePasswordConfig getChangePassword();

/**
* Returns the {@link MobileCallbackConfig mobileCallbackConfig} associated to this {@link ApplicationWebConfig applicationWebConfig}.
*
* @return the {@link MobileCallbackConfig mobileCallbackConfig} associated to this {@link ApplicationWebConfig applicationWebConfig}.
*/
MobileCallbackConfig getMobileCallback();

/**
* Returns the {@link MeConfig meConfig} associated to this {@link ApplicationWebConfig applicationWebConfig}.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright 2016 Stormpath, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.stormpath.sdk.application.webconfig;

import com.stormpath.sdk.resource.ResourceException;

/**
* @since 1.5.0
*/
public interface MobileCallbackConfig extends WebFeatureConfig<MobileCallbackConfig> {

/**
* Overriding to note that {@code this} configuration doesn't allow to set the {@code enable} flag to {@code null}.
*
* @param enabled {@code boolean} value to enable or disable a web features.
* @throws ResourceException when set to {@code null}.
*/
@Override
MobileCallbackConfig setEnabled(Boolean enabled);
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class WebConfigurationIT extends ClientIT {

assertTrue webConfiguration.getLogin().enabled
assertTrue webConfiguration.getOAuth2().enabled
assertFalse webConfiguration.getMobileCallback().enabled

assertEquals requestCountingClient.requestCount, 2
}
Expand All @@ -71,6 +72,7 @@ class WebConfigurationIT extends ClientIT {

webConfig.getLogin().setEnabled(false)
webConfig.getRegister().setEnabled(false)
webConfig.getMobileCallback().setEnabled(true)

Oauth2Config oauth2Config = webConfig.getOAuth2()
oauth2Config.setEnabled(false)
Expand All @@ -88,6 +90,7 @@ class WebConfigurationIT extends ClientIT {

assertFalse readWebConfig.getRegister().isEnabled()
assertFalse readWebConfig.getLogin().isEnabled()
assertTrue readWebConfig.getMobileCallback().isEnabled()

Oauth2Config readOAuth2 = readWebConfig.getOAuth2()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.stormpath.sdk.application.webconfig.ForgotPasswordConfig;
import com.stormpath.sdk.application.webconfig.LoginConfig;
import com.stormpath.sdk.application.webconfig.MeConfig;
import com.stormpath.sdk.application.webconfig.MobileCallbackConfig;
import com.stormpath.sdk.application.webconfig.Oauth2Config;
import com.stormpath.sdk.application.webconfig.RegisterConfig;
import com.stormpath.sdk.application.webconfig.VerifyEmailConfig;
Expand Down Expand Up @@ -58,6 +59,7 @@ public class DefaultApplicationWebConfig extends AbstractInstanceResource implem
private static final ParentAwareObjectProperty<DefaultWebFeatureConfig.VerifyEmail, AbstractPropertyRetriever> VERIFY_EMAIL;
private static final ParentAwareObjectProperty<DefaultWebFeatureConfig.ForgotPassword, AbstractPropertyRetriever> FORGOT_PASSWORD;
private static final ParentAwareObjectProperty<DefaultWebFeatureConfig.ChangePassword, AbstractPropertyRetriever> CHANGE_PASSWORD;
private static final ParentAwareObjectProperty<DefaultWebFeatureConfig.MobileCallback, AbstractPropertyRetriever> MOBILE_CALLBACK;
private static final ParentAwareObjectProperty<DefaultMeConfig, AbstractPropertyRetriever> ME;
// INSTANCE RESOURCE REFERENCES:
private static final ResourceReference<ApiKey> SIGNING_API_KEY = new ResourceReference<>("signingApiKey", ApiKey.class);
Expand All @@ -71,11 +73,12 @@ public class DefaultApplicationWebConfig extends AbstractInstanceResource implem
VERIFY_EMAIL = new ParentAwareObjectProperty<>("verifyEmail", DefaultWebFeatureConfig.VerifyEmail.class, AbstractPropertyRetriever.class);
FORGOT_PASSWORD = new ParentAwareObjectProperty<>("forgotPassword", DefaultWebFeatureConfig.ForgotPassword.class, AbstractPropertyRetriever.class);
CHANGE_PASSWORD = new ParentAwareObjectProperty<>("changePassword", DefaultWebFeatureConfig.ChangePassword.class, AbstractPropertyRetriever.class);
MOBILE_CALLBACK = new ParentAwareObjectProperty<>("mobileCallback", DefaultWebFeatureConfig.MobileCallback.class, AbstractPropertyRetriever.class);
ME = new ParentAwareObjectProperty<>("me", DefaultMeConfig.class, AbstractPropertyRetriever.class);
}

private static final Map<String, Property> PROPERTY_DESCRIPTORS = createPropertyDescriptorMap(CREATED_AT, MODIFIED_AT, DOMAIN_NAME,
DNS_LABEL, STATUS, OAUTH2, REGISTER, VERIFY_EMAIL, FORGOT_PASSWORD, CHANGE_PASSWORD,
DNS_LABEL, STATUS, OAUTH2, REGISTER, VERIFY_EMAIL, FORGOT_PASSWORD, CHANGE_PASSWORD, MOBILE_CALLBACK,
SIGNING_API_KEY, APPLICATION, TENANT);


Expand Down Expand Up @@ -170,6 +173,11 @@ public ChangePasswordConfig getChangePassword() {
return getParentAwareObjectProperty(CHANGE_PASSWORD);
}

@Override
public MobileCallbackConfig getMobileCallback() {
return getParentAwareObjectProperty(MOBILE_CALLBACK);
}

@Override
public MeConfig getMe() {
return getParentAwareObjectProperty(ME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.stormpath.sdk.application.webconfig.ChangePasswordConfig;
import com.stormpath.sdk.application.webconfig.ForgotPasswordConfig;
import com.stormpath.sdk.application.webconfig.LoginConfig;
import com.stormpath.sdk.application.webconfig.MobileCallbackConfig;
import com.stormpath.sdk.application.webconfig.RegisterConfig;
import com.stormpath.sdk.application.webconfig.VerifyEmailConfig;
import com.stormpath.sdk.application.webconfig.WebFeatureConfig;
Expand Down Expand Up @@ -78,4 +79,10 @@ public VerifyEmail(String name, Map<String, Object> properties, AbstractProperty
}
}

public static class MobileCallback extends DefaultWebFeatureConfig<MobileCallbackConfig> implements MobileCallbackConfig {
public MobileCallback(String name, Map<String, Object> properties, AbstractPropertyRetriever parent) {
super(name, properties, parent);
}
}

}