Skip to content
Permalink
Browse files
Merge pull request #4 from myrle-krantz/develop
Updating package names.
  • Loading branch information
myrle-krantz committed Apr 16, 2018
2 parents 060c11b + 507e9ec commit 6ec6c01a5ccb3cd9c846c2550e7622c197168df9
Showing 25 changed files with 150 additions and 152 deletions.
@@ -1,8 +1,6 @@
# Apache Fineract CN Permitted Feign Client Library

[![Join the chat at https://gitter.im/mifos-initiative/mifos.io](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/mifos-initiative/mifos.io?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

This project provides secured access to other microservices via Feign. For this it uses anubis and identity to provide refresh and access tokens transparently.
This project provides secured access to other services via Feign. For this it uses anubis and identity to provide refresh and access tokens transparently.

## Abstract
Apache Fineract CN is an application framework for digital financial services, a system to support nationwide and cross-national financial transactions and help to level and speed the creation of an inclusive, interconnected digital economy for every nation in the world.
@@ -16,10 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
package io.mifos.another.api;
package org.apache.fineract.cn.permittedfeignclient.another.api;

import io.mifos.anubis.api.v1.client.Anubis;
import io.mifos.core.api.util.CustomFeignClientsConfiguration;
import org.apache.fineract.cn.anubis.api.v1.client.Anubis;
import org.apache.fineract.cn.api.util.CustomFeignClientsConfiguration;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -16,12 +16,12 @@
* specific language governing permissions and limitations
* under the License.
*/
package io.mifos.another.service;
package org.apache.fineract.cn.permittedfeignclient.another.service;

import io.mifos.anubis.config.EnableAnubis;
import io.mifos.core.lang.config.EnableApplicationName;
import io.mifos.core.lang.config.EnableServiceException;
import io.mifos.core.lang.config.EnableTenantContext;
import org.apache.fineract.cn.anubis.config.EnableAnubis;
import org.apache.fineract.cn.lang.config.EnableApplicationName;
import org.apache.fineract.cn.lang.config.EnableServiceException;
import org.apache.fineract.cn.lang.config.EnableTenantContext;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@@ -41,7 +41,7 @@
@EnableApplicationName
@EnableServiceException
@ComponentScan({
"io.mifos.another.service"
"org.apache.fineract.cn.permittedfeignclient.another.service"
})
public class AnotherConfiguration {

@@ -16,10 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
package io.mifos.another.service;
package org.apache.fineract.cn.permittedfeignclient.another.service;

import io.mifos.anubis.annotation.AcceptedTokenType;
import io.mifos.anubis.annotation.Permittable;
import org.apache.fineract.cn.anubis.annotation.AcceptedTokenType;
import org.apache.fineract.cn.anubis.annotation.Permittable;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -16,9 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
package io.mifos.permittedfeignclient.api.v1.client;
package org.apache.finearct.cn.permittedfeignclient.api.v1.client;

import io.mifos.permittedfeignclient.api.v1.domain.ApplicationPermission;
import org.apache.finearct.cn.permittedfeignclient.api.v1.domain.ApplicationPermission;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -16,14 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
package io.mifos.permittedfeignclient.api.v1.domain;

import io.mifos.core.lang.validation.constraints.ValidIdentifier;
import io.mifos.identity.api.v1.domain.Permission;
package org.apache.finearct.cn.permittedfeignclient.api.v1.domain;

import java.util.Objects;
import javax.annotation.Nullable;
import javax.validation.Valid;
import java.util.Objects;
import org.apache.fineract.cn.identity.api.v1.domain.Permission;
import org.apache.fineract.cn.lang.validation.constraints.ValidIdentifier;

/**
* @author Myrle Krantz
@@ -16,26 +16,42 @@
* specific language governing permissions and limitations
* under the License.
*/
import static accessanother.service.apiforother.AnotherWithApplicationPermissions.ENDPOINT_SET_IDENTIFIER;
import static org.apache.fineract.cn.test.env.TestEnvironment.RIBBON_USES_EUREKA_PROPERTY;
import static org.apache.fineract.cn.test.env.TestEnvironment.SPRING_CLOUD_DISCOVERY_ENABLED_PROPERTY;

import accessanother.api.AccessAnother;
import accessanother.service.AccessAnotherConfiguration;
import io.mifos.another.api.Another;
import io.mifos.anubis.api.v1.domain.AllowedOperation;
import io.mifos.anubis.test.v1.TenantApplicationSecurityEnvironmentTestRule;
import io.mifos.core.api.config.EnableApiFactory;
import io.mifos.core.api.context.AutoUserContext;
import io.mifos.core.api.util.ApiFactory;
import io.mifos.core.lang.DateConverter;
import io.mifos.core.test.env.TestEnvironment;
import io.mifos.core.test.fixture.cassandra.CassandraInitializer;
import io.mifos.core.test.servicestarter.EurekaForTest;
import io.mifos.core.test.servicestarter.InitializedMicroservice;
import io.mifos.core.test.servicestarter.IntegrationTestEnvironment;
import io.mifos.identity.api.v1.client.IdentityManager;
import io.mifos.identity.api.v1.domain.Authentication;
import io.mifos.identity.api.v1.domain.Permission;
import io.mifos.permittedfeignclient.api.v1.client.ApplicationPermissionRequirements;
import io.mifos.permittedfeignclient.api.v1.domain.ApplicationPermission;
import org.junit.*;
import org.apache.fineract.cn.permittedfeignclient.another.api.Another;
import org.apache.finearct.cn.permittedfeignclient.api.v1.client.ApplicationPermissionRequirements;
import org.apache.finearct.cn.permittedfeignclient.api.v1.domain.ApplicationPermission;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.apache.fineract.cn.anubis.api.v1.domain.AllowedOperation;
import org.apache.fineract.cn.anubis.test.v1.TenantApplicationSecurityEnvironmentTestRule;
import org.apache.fineract.cn.api.config.EnableApiFactory;
import org.apache.fineract.cn.api.context.AutoUserContext;
import org.apache.fineract.cn.api.util.ApiFactory;
import org.apache.fineract.cn.identity.api.v1.client.IdentityManager;
import org.apache.fineract.cn.identity.api.v1.domain.Authentication;
import org.apache.fineract.cn.identity.api.v1.domain.Permission;
import org.apache.fineract.cn.lang.DateConverter;
import org.apache.fineract.cn.test.env.TestEnvironment;
import org.apache.fineract.cn.test.fixture.cassandra.CassandraInitializer;
import org.apache.fineract.cn.test.servicestarter.EurekaForTest;
import org.apache.fineract.cn.test.servicestarter.InitializedMicroservice;
import org.apache.fineract.cn.test.servicestarter.IntegrationTestEnvironment;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.RuleChain;
import org.junit.rules.TestRule;
import org.junit.runner.RunWith;
@@ -50,18 +66,6 @@
import org.springframework.context.annotation.Import;
import org.springframework.test.context.junit4.SpringRunner;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.concurrent.TimeUnit;

import static accessanother.service.apiforother.AnotherWithApplicationPermissions.ENDPOINT_SET_IDENTIFIER;
import static io.mifos.core.test.env.TestEnvironment.RIBBON_USES_EUREKA_PROPERTY;
import static io.mifos.core.test.env.TestEnvironment.SPRING_CLOUD_DISCOVERY_ENABLED_PROPERTY;

/**
* @author Myrle Krantz
*/
@@ -18,8 +18,8 @@
*/
package accessanother.api;

import io.mifos.anubis.api.v1.client.Anubis;
import io.mifos.core.api.util.CustomFeignClientsConfiguration;
import org.apache.fineract.cn.anubis.api.v1.client.Anubis;
import org.apache.fineract.cn.api.util.CustomFeignClientsConfiguration;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -19,10 +19,10 @@
package accessanother.service;

import accessanother.service.apiforother.AnotherWithApplicationPermissions;
import io.mifos.anubis.config.EnableAnubis;
import io.mifos.core.lang.config.EnableServiceException;
import io.mifos.core.lang.config.EnableTenantContext;
import io.mifos.permittedfeignclient.config.EnablePermissionRequestingFeignClient;
import org.apache.fineract.cn.permittedfeignclient.config.EnablePermissionRequestingFeignClient;
import org.apache.fineract.cn.anubis.config.EnableAnubis;
import org.apache.fineract.cn.lang.config.EnableServiceException;
import org.apache.fineract.cn.lang.config.EnableTenantContext;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
@@ -19,7 +19,7 @@
package accessanother.service;

import accessanother.service.apiforother.AnotherWithApplicationPermissions;
import io.mifos.anubis.annotation.Permittable;
import org.apache.fineract.cn.anubis.annotation.Permittable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -18,9 +18,9 @@
*/
package accessanother.service.apiforother;

import io.mifos.anubis.annotation.Permittable;
import io.mifos.permittedfeignclient.annotation.EndpointSet;
import io.mifos.permittedfeignclient.annotation.PermittedFeignClientsConfiguration;
import org.apache.fineract.cn.permittedfeignclient.annotation.EndpointSet;
import org.apache.fineract.cn.permittedfeignclient.annotation.PermittedFeignClientsConfiguration;
import org.apache.fineract.cn.anubis.annotation.Permittable;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package io.mifos.permittedfeignclient;
package org.apache.fineract.cn.permittedfeignclient;

/**
* @author Myrle Krantz
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package io.mifos.permittedfeignclient.annotation;
package org.apache.fineract.cn.permittedfeignclient.annotation;

import java.lang.annotation.*;

@@ -16,18 +16,20 @@
* specific language governing permissions and limitations
* under the License.
*/
package io.mifos.permittedfeignclient.annotation;
package org.apache.fineract.cn.permittedfeignclient.annotation;

import static org.apache.fineract.cn.api.config.ApiConfiguration.LOGGER_NAME;

import feign.Feign;
import feign.Target;
import feign.codec.Decoder;
import feign.codec.Encoder;
import feign.gson.GsonDecoder;
import feign.gson.GsonEncoder;
import io.mifos.core.api.util.AnnotatedErrorDecoder;
import io.mifos.core.api.util.TenantedTargetInterceptor;
import io.mifos.permittedfeignclient.security.ApplicationTokenedTargetInterceptor;
import io.mifos.permittedfeignclient.service.ApplicationAccessTokenService;
import org.apache.fineract.cn.permittedfeignclient.security.ApplicationTokenedTargetInterceptor;
import org.apache.fineract.cn.permittedfeignclient.service.ApplicationAccessTokenService;
import org.apache.fineract.cn.api.util.AnnotatedErrorDecoder;
import org.apache.fineract.cn.api.util.TenantedTargetInterceptor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Qualifier;
@@ -36,8 +38,6 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Scope;

import static io.mifos.core.api.config.ApiConfiguration.LOGGER_NAME;

/**
* @author Myrle Krantz
*/
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package io.mifos.permittedfeignclient.config;
package org.apache.fineract.cn.permittedfeignclient.config;

import org.springframework.context.annotation.Import;

@@ -16,9 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
package io.mifos.permittedfeignclient.config;
package org.apache.fineract.cn.permittedfeignclient.config;

import io.mifos.permittedfeignclient.service.ApplicationPermissionRequirementsService;
import org.apache.fineract.cn.permittedfeignclient.service.ApplicationPermissionRequirementsService;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
@@ -16,28 +16,27 @@
* specific language governing permissions and limitations
* under the License.
*/
package io.mifos.permittedfeignclient.config;
package org.apache.fineract.cn.permittedfeignclient.config;

import feign.Client;
import feign.Feign;
import feign.gson.GsonDecoder;
import feign.gson.GsonEncoder;
import io.mifos.anubis.config.EnableAnubis;
import io.mifos.core.api.util.AnnotatedErrorDecoder;
import io.mifos.core.api.util.EmptyBodyInterceptor;
import io.mifos.core.api.util.TenantedTargetInterceptor;
import io.mifos.core.api.util.TokenedTargetInterceptor;
import io.mifos.identity.api.v1.client.IdentityManager;
import io.mifos.permittedfeignclient.LibraryConstants;
import org.apache.fineract.cn.permittedfeignclient.LibraryConstants;
import javax.annotation.Nonnull;
import org.apache.fineract.cn.anubis.config.EnableAnubis;
import org.apache.fineract.cn.api.util.AnnotatedErrorDecoder;
import org.apache.fineract.cn.api.util.EmptyBodyInterceptor;
import org.apache.fineract.cn.api.util.TenantedTargetInterceptor;
import org.apache.fineract.cn.api.util.TokenedTargetInterceptor;
import org.apache.fineract.cn.identity.api.v1.client.IdentityManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.cloud.netflix.feign.support.SpringMvcContract;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Nonnull;

/**
* @author Myrle Krantz
*/
@@ -16,10 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
package io.mifos.permittedfeignclient.config;
package org.apache.fineract.cn.permittedfeignclient.config;

import io.mifos.permittedfeignclient.controller.ApplicationPermissionRequirementsRestController;
import io.mifos.permittedfeignclient.service.ApplicationAccessTokenService;
import org.apache.fineract.cn.permittedfeignclient.controller.ApplicationPermissionRequirementsRestController;
import org.apache.fineract.cn.permittedfeignclient.service.ApplicationAccessTokenService;
import org.springframework.context.annotation.ImportSelector;
import org.springframework.core.type.AnnotationMetadata;

@@ -16,12 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
package io.mifos.permittedfeignclient.controller;
package org.apache.fineract.cn.permittedfeignclient.controller;

import io.mifos.anubis.annotation.AcceptedTokenType;
import io.mifos.anubis.annotation.Permittable;
import io.mifos.permittedfeignclient.service.ApplicationPermissionRequirementsService;
import io.mifos.permittedfeignclient.api.v1.domain.ApplicationPermission;
import org.apache.finearct.cn.permittedfeignclient.api.v1.domain.ApplicationPermission;
import org.apache.fineract.cn.permittedfeignclient.service.ApplicationPermissionRequirementsService;
import java.util.ArrayList;
import java.util.List;
import org.apache.fineract.cn.anubis.annotation.AcceptedTokenType;
import org.apache.fineract.cn.anubis.annotation.Permittable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@@ -30,8 +32,6 @@
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.*;

/**
* @author Myrle Krantz
*/

0 comments on commit 6ec6c01

Please sign in to comment.