Skip to content
Permalink
Browse files
Adjusting to package name changes in upstream repositories.
  • Loading branch information
myrle-krantz committed Apr 13, 2018
1 parent 179ecf6 commit 7c9ca0339f3ad70f6f362249aa72fecd0116e5f3
Showing 62 changed files with 401 additions and 328 deletions.
@@ -18,20 +18,32 @@
*/
package io.mifos.identity.api.v1.client;

import io.mifos.anubis.api.v1.client.Anubis;
import io.mifos.anubis.api.v1.domain.ApplicationSignatureSet;
import io.mifos.anubis.api.v1.domain.Signature;
import io.mifos.anubis.api.v1.validation.ValidKeyTimestamp;
import io.mifos.core.api.annotation.ThrowsException;
import io.mifos.core.api.util.CustomFeignClientsConfiguration;
import io.mifos.identity.api.v1.domain.*;
import io.mifos.identity.api.v1.domain.Authentication;
import io.mifos.identity.api.v1.domain.CallEndpointSet;
import io.mifos.identity.api.v1.domain.Password;
import io.mifos.identity.api.v1.domain.Permission;
import io.mifos.identity.api.v1.domain.PermittableGroup;
import io.mifos.identity.api.v1.domain.Role;
import io.mifos.identity.api.v1.domain.RoleIdentifier;
import io.mifos.identity.api.v1.domain.User;
import io.mifos.identity.api.v1.domain.UserWithPassword;
import java.util.List;
import java.util.Set;
import org.apache.fineract.cn.anubis.api.v1.client.Anubis;
import org.apache.fineract.cn.anubis.api.v1.domain.ApplicationSignatureSet;
import org.apache.fineract.cn.anubis.api.v1.domain.Signature;
import org.apache.fineract.cn.anubis.api.v1.validation.ValidKeyTimestamp;
import org.apache.fineract.cn.api.annotation.ThrowsException;
import org.apache.fineract.cn.api.util.CustomFeignClientsConfiguration;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Set;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

/**
* @author Myrle Krantz
@@ -18,11 +18,11 @@
*/
package io.mifos.identity.api.v1.domain;

import io.mifos.core.lang.validation.constraints.ValidIdentifier;

import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Objects;
import org.apache.fineract.cn.lang.validation.constraints.ValidIdentifier;

/**
* @author Myrle Krantz
@@ -18,13 +18,12 @@
*/
package io.mifos.identity.api.v1.domain;

import io.mifos.anubis.api.v1.domain.AllowedOperation;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.Objects;
import java.util.Set;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import org.apache.fineract.cn.anubis.api.v1.domain.AllowedOperation;
import org.hibernate.validator.constraints.NotBlank;

/**
* @author Myrle Krantz
@@ -18,12 +18,12 @@
*/
package io.mifos.identity.api.v1.domain;

import io.mifos.anubis.api.v1.domain.PermittableEndpoint;
import io.mifos.core.lang.validation.constraints.ValidIdentifier;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Objects;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import org.apache.fineract.cn.anubis.api.v1.domain.PermittableEndpoint;
import org.apache.fineract.cn.lang.validation.constraints.ValidIdentifier;

/**
* @author Myrle Krantz
@@ -18,8 +18,8 @@
*/
package io.mifos.identity.api.v1.domain;

import io.mifos.core.lang.validation.constraints.ValidIdentifier;
import io.mifos.identity.api.v1.validation.ChangeableRole;
import org.apache.fineract.cn.lang.validation.constraints.ValidIdentifier;
import org.hibernate.validator.constraints.ScriptAssert;
import org.springframework.util.Assert;

@@ -18,7 +18,7 @@
*/
package io.mifos.identity.api.v1.domain;

import io.mifos.core.lang.validation.constraints.ValidIdentifier;
import org.apache.fineract.cn.lang.validation.constraints.ValidIdentifier;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.ScriptAssert;
@@ -18,14 +18,13 @@
*/
package io.mifos.identity.api.v1.domain;

import io.mifos.core.test.domain.ValidationTest;
import io.mifos.core.test.domain.ValidationTestCase;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import org.apache.fineract.cn.test.domain.ValidationTest;
import org.apache.fineract.cn.test.domain.ValidationTestCase;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

/**
* @author Myrle Krantz
@@ -18,8 +18,8 @@
*/
package io.mifos.identity.v1.domain;

import io.mifos.core.test.domain.ValidationTestCase;
import io.mifos.identity.api.v1.domain.Password;
import org.apache.fineract.cn.test.domain.ValidationTestCase;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -18,8 +18,8 @@
*/
package io.mifos.identity.v1.domain;

import io.mifos.core.test.domain.ValidationTestCase;
import io.mifos.identity.api.v1.domain.RoleIdentifier;
import org.apache.fineract.cn.test.domain.ValidationTestCase;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -18,15 +18,14 @@
*/
package io.mifos.identity.v1.domain;

import io.mifos.core.test.domain.ValidationTest;
import io.mifos.core.test.domain.ValidationTestCase;
import io.mifos.identity.api.v1.domain.Role;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import org.apache.fineract.cn.test.domain.ValidationTest;
import org.apache.fineract.cn.test.domain.ValidationTestCase;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

/**
* @author Myrle Krantz
@@ -18,17 +18,16 @@
*/
package io.mifos.identity.v1.domain;

import io.mifos.core.api.util.ApiConstants;
import io.mifos.core.test.domain.ValidationTestCase;
import io.mifos.identity.api.v1.domain.UserWithPassword;
import java.util.ArrayList;
import java.util.Collection;
import org.apache.fineract.cn.api.util.ApiConstants;
import org.apache.fineract.cn.test.domain.ValidationTestCase;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import java.util.ArrayList;
import java.util.Collection;

/**
* @author Myrle Krantz
*/
@@ -16,27 +16,33 @@
* specific language governing permissions and limitations
* under the License.
*/
import io.mifos.anubis.api.v1.domain.AllowedOperation;
import io.mifos.anubis.api.v1.domain.Signature;
import io.mifos.anubis.test.v1.TenantApplicationSecurityEnvironmentTestRule;
import io.mifos.core.api.config.EnableApiFactory;
import io.mifos.core.api.context.AutoGuest;
import io.mifos.core.api.context.AutoUserContext;
import io.mifos.core.api.util.ApiFactory;
import io.mifos.core.api.util.UserContextHolder;
import io.mifos.core.lang.security.RsaKeyPairFactory;
import io.mifos.core.test.env.TestEnvironment;
import io.mifos.core.test.fixture.TenantDataStoreContextTestRule;
import io.mifos.core.test.listener.EnableEventRecording;
import io.mifos.core.test.listener.EventRecorder;
import io.mifos.identity.api.v1.PermittableGroupIds;
import io.mifos.identity.api.v1.client.IdentityManager;
import io.mifos.identity.api.v1.domain.*;
import io.mifos.identity.api.v1.domain.Authentication;
import io.mifos.identity.api.v1.domain.Password;
import io.mifos.identity.api.v1.domain.Permission;
import io.mifos.identity.api.v1.domain.Role;
import io.mifos.identity.api.v1.domain.UserWithPassword;
import io.mifos.identity.api.v1.events.ApplicationPermissionEvent;
import io.mifos.identity.api.v1.events.ApplicationSignatureEvent;
import io.mifos.identity.api.v1.events.EventConstants;
import io.mifos.identity.config.IdentityServiceConfig;
import java.util.Arrays;
import javax.annotation.PostConstruct;
import org.apache.commons.lang.RandomStringUtils;
import org.apache.fineract.cn.anubis.api.v1.domain.AllowedOperation;
import org.apache.fineract.cn.anubis.api.v1.domain.Signature;
import org.apache.fineract.cn.anubis.test.v1.TenantApplicationSecurityEnvironmentTestRule;
import org.apache.fineract.cn.api.config.EnableApiFactory;
import org.apache.fineract.cn.api.context.AutoGuest;
import org.apache.fineract.cn.api.context.AutoUserContext;
import org.apache.fineract.cn.api.util.ApiFactory;
import org.apache.fineract.cn.api.util.UserContextHolder;
import org.apache.fineract.cn.lang.security.RsaKeyPairFactory;
import org.apache.fineract.cn.test.env.TestEnvironment;
import org.apache.fineract.cn.test.fixture.TenantDataStoreContextTestRule;
import org.apache.fineract.cn.test.listener.EnableEventRecording;
import org.apache.fineract.cn.test.listener.EventRecorder;
import org.junit.After;
import org.junit.Assert;
import org.junit.ClassRule;
@@ -49,9 +55,6 @@
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.PostConstruct;
import java.util.Arrays;

/**
* @author Myrle Krantz
*/
@@ -16,8 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
import io.mifos.core.test.env.TestEnvironment;
import io.mifos.core.test.fixture.cassandra.CassandraInitializer;
import org.apache.fineract.cn.test.env.TestEnvironment;
import org.apache.fineract.cn.test.fixture.cassandra.CassandraInitializer;
import org.junit.ClassRule;
import org.junit.rules.RuleChain;
import org.junit.rules.RunExternalResourceOnce;
@@ -16,11 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
import io.mifos.anubis.api.v1.domain.AllowedOperation;
import io.mifos.anubis.token.TenantRefreshTokenSerializer;
import io.mifos.anubis.token.TokenSerializationResult;
import io.mifos.core.api.context.AutoUserContext;
import io.mifos.core.api.util.NotFoundException;
import io.mifos.identity.api.v1.PermittableGroupIds;
import io.mifos.identity.api.v1.domain.Authentication;
import io.mifos.identity.api.v1.domain.CallEndpointSet;
@@ -31,6 +26,11 @@
import io.mifos.identity.api.v1.events.ApplicationPermissionUserEvent;
import io.mifos.identity.api.v1.events.EventConstants;
import org.apache.commons.lang.RandomStringUtils;
import org.apache.fineract.cn.anubis.api.v1.domain.AllowedOperation;
import org.apache.fineract.cn.anubis.token.TenantRefreshTokenSerializer;
import org.apache.fineract.cn.anubis.token.TokenSerializationResult;
import org.apache.fineract.cn.api.context.AutoUserContext;
import org.apache.fineract.cn.api.util.NotFoundException;
import org.junit.Assert;
import org.junit.Test;

@@ -16,25 +16,40 @@
* specific language governing permissions and limitations
* under the License.
*/
import static io.mifos.identity.api.v1.events.EventConstants.OPERATION_POST_PERMITTABLE_GROUP;
import static io.mifos.identity.api.v1.events.EventConstants.OPERATION_POST_ROLE;
import static io.mifos.identity.api.v1.events.EventConstants.OPERATION_POST_USER;
import static io.mifos.identity.api.v1.events.EventConstants.OPERATION_PUT_USER_PASSWORD;

import com.google.common.collect.Sets;
import io.mifos.anubis.api.v1.client.Anubis;
import io.mifos.anubis.api.v1.domain.*;
import io.mifos.anubis.test.v1.SystemSecurityEnvironment;
import io.mifos.core.api.context.AutoUserContext;
import io.mifos.core.api.util.InvalidTokenException;
import io.mifos.core.api.util.NotFoundException;
import io.mifos.core.lang.AutoTenantContext;
import io.mifos.core.lang.security.RsaPublicKeyBuilder;
import io.mifos.core.test.env.TestEnvironment;
import io.mifos.identity.api.v1.domain.*;
import io.mifos.identity.api.v1.domain.Authentication;
import io.mifos.identity.api.v1.domain.Password;
import io.mifos.identity.api.v1.domain.Permission;
import io.mifos.identity.api.v1.domain.PermittableGroup;
import io.mifos.identity.api.v1.domain.Role;
import io.mifos.identity.api.v1.domain.UserWithPassword;
import java.security.PublicKey;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.apache.fineract.cn.anubis.api.v1.client.Anubis;
import org.apache.fineract.cn.anubis.api.v1.domain.AllowedOperation;
import org.apache.fineract.cn.anubis.api.v1.domain.PermittableEndpoint;
import org.apache.fineract.cn.anubis.api.v1.domain.Signature;
import org.apache.fineract.cn.anubis.api.v1.domain.TokenContent;
import org.apache.fineract.cn.anubis.api.v1.domain.TokenPermission;
import org.apache.fineract.cn.anubis.test.v1.SystemSecurityEnvironment;
import org.apache.fineract.cn.api.context.AutoUserContext;
import org.apache.fineract.cn.api.util.InvalidTokenException;
import org.apache.fineract.cn.api.util.NotFoundException;
import org.apache.fineract.cn.lang.AutoTenantContext;
import org.apache.fineract.cn.lang.security.RsaPublicKeyBuilder;
import org.apache.fineract.cn.test.env.TestEnvironment;
import org.junit.Assert;
import org.junit.Test;

import java.security.PublicKey;
import java.util.*;

import static io.mifos.identity.api.v1.events.EventConstants.*;

/**
* @author Myrle Krantz
*/
@@ -137,7 +152,8 @@ public void testPermissionsCorrectInTokenWhenMultiplePermittableGroupsInRole() t
}

final Authentication authentication = getTestSubject().login(user.getIdentifier(), user.getPassword());
final TokenContent tokenContent = SystemSecurityEnvironment.getTokenContent(authentication.getAccessToken(), getPublicKey());
final TokenContent tokenContent = SystemSecurityEnvironment
.getTokenContent(authentication.getAccessToken(), getPublicKey());
final Set<TokenPermission> tokenPermissions = new HashSet<>(tokenContent.getTokenPermissions());

final Set<TokenPermission> expectedTokenPermissions= new HashSet<>();
@@ -16,20 +16,19 @@
* specific language governing permissions and limitations
* under the License.
*/
import io.mifos.anubis.api.v1.client.Anubis;
import io.mifos.anubis.api.v1.domain.ApplicationSignatureSet;
import io.mifos.anubis.api.v1.domain.Signature;
import io.mifos.core.api.context.AutoGuest;
import io.mifos.core.api.context.AutoSeshat;
import io.mifos.core.api.context.AutoUserContext;
import io.mifos.core.api.util.NotFoundException;
import io.mifos.core.test.env.TestEnvironment;
import io.mifos.identity.api.v1.domain.Authentication;
import org.junit.Assert;
import org.junit.Test;

import java.util.List;
import java.util.concurrent.TimeUnit;
import org.apache.fineract.cn.anubis.api.v1.client.Anubis;
import org.apache.fineract.cn.anubis.api.v1.domain.ApplicationSignatureSet;
import org.apache.fineract.cn.anubis.api.v1.domain.Signature;
import org.apache.fineract.cn.api.context.AutoGuest;
import org.apache.fineract.cn.api.context.AutoSeshat;
import org.apache.fineract.cn.api.context.AutoUserContext;
import org.apache.fineract.cn.api.util.NotFoundException;
import org.apache.fineract.cn.test.env.TestEnvironment;
import org.junit.Assert;
import org.junit.Test;

/**
* @author Myrle Krantz
@@ -82,7 +81,8 @@ public void testKeyRotation() throws InterruptedException {

final Authentication adminAuthenticationOnSecondKeyset;
try (final AutoUserContext ignored2 = new AutoGuest()) {
adminAuthenticationOnSecondKeyset = getTestSubject().login(ADMIN_IDENTIFIER, TestEnvironment.encodePassword(ADMIN_PASSWORD));
adminAuthenticationOnSecondKeyset = getTestSubject().login(ADMIN_IDENTIFIER, TestEnvironment
.encodePassword(ADMIN_PASSWORD));
}

Assert.assertTrue(canAccessResources(adminAuthenticationOnFirstKeyset));

0 comments on commit 7c9ca03

Please sign in to comment.