Giter Site home page Giter Site logo

springbox-cloud's Introduction

springbox-cloud is no longer actively maintained by VMware, Inc.

SpringBox Reference Application

Running Locally

  1. Clone the repo.

  2. Import the root pom.xml into your favorite IDE or run mvn package.

  3. Download and install the following services:

    1. RabbitMQ

    2. MongoDB

    3. Neo4J Community Editioni - version 2.1.x - Cypher changes won’t make it possible to work with 2.2.x

  4. Either from the IDE or the command line (i.e. java -jar target/appname.jar), run the applications in the following order:

    1. springbox-config-server

    2. springbox-eureka

    3. springbox-auth-server

    4. springbox-catalog

    5. springbox-reviews

    6. springbox-recommendations

    7. springbox-api-gateway

  5. Load data into the reviews DB by running springbox-reviews/scripts/loadReviews.sh.

  6. Load data into the recommendations DB by running springbox-recommendations/scripts/loadGraph.sh.

  7. Visit http://localhost:9000 and you should see something like the following:

    homepage

springbox-cloud's People

Contributors

scottfrederick avatar trevormarshall avatar viniciusccarvalho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

springbox-cloud's Issues

Oauth2 example with database persistence

It would be nice add some database persistence example for OAuth tokens / User details and client credentials. Even using an in-memory DB (H2) it helps us to migrate to a real world scenario.

Can not run script

Hello when i start all services and then run script there is error :

./loadReviews.sh
{"error":"unauthorized","error_description":"Full authentication is required to access this resource"}{"error":"unauthorized","error_description":"Full authentication is required to access this resource"}{"error":"unauthorized","error_description":"Full authentication is required to access this resource"}{"error":"unauthorized","error_description":"Full authentication is required to access this resource"}{"error":"unauthorized","error_description":"Full authentication is required to access this resource"}{"error":"unauthorized","error_description":"Full authentication is required to access this resource"}{"error":"unauthorized","error_description":"Full authentication is required to access this resource"}{"error":"unauthorized","error_description":"Full authentication is required to access this resource"}

Properly pass through OAuth2 token from API Gateway via RestTemplate to Recommendations service for likes

https://github.com/mstine/springbox-cloud/blob/master/springbox-api-gateway/src/main/java/io/springbox/apigateway/services/recommendations/RecommendationsIntegrationService.java#L41 is trying to determine if the current userName "likes" the movie in question.

The associated endpoint in springbox-recommendations will be secured based on #2.

According to Syer, you should be able to inject an OAuth2RestOperations and that will pass on the current token. However, I'm not sure if that will also have the RibbonInterceptor, so we may need to do the Ribbon lookup manually.

Resolving this issue should determine what will work and implement it.

Properly enable OAuth2 authorization on springbox-recommendations

Four controllers:

RecommendationsController:

  1. POST /recommendations/{userName}/likes/{mlId} - OAUTH2 SECURED
  2. GET /recommendations/forUser/{userName} - OPEN (eventually secure to just that user)
  3. GET /recommendations/forMovie/{mlId} - OPEN

PersonController:

  1. GET `/people' - OPEN (eventually secured to admin)
  2. POST /people - OAUTH2 SECURED (eventually an admin function)

MovieController:

  1. GET `/movie' - OPEN
  2. POST /movie - OAUTH2 SECURED (eventually an admin function)

LikesController:

  1. GET /likes - OPEN (eventually secured to admin)
  2. GET /does/{userName}/like/{mlId} - OAUTH2 SECURED (eventually secure to just that user)

Hystrix errors with spring singleton beans

Seems that some Oauth beans need to run on the same thread that the caller, this lead to errors bellow. Because methods are ran inside hystrix commands, we don't have access to the original thread.

Need to investigate further:

Error creating bean with name 'scopedTarget.oauth2ClientContext': Scope 'session' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton

java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.

0 = {java.lang.StackTraceElement@11409} "org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:352)"
1 = {java.lang.StackTraceElement@11410} "org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)"
2 = {java.lang.StackTraceElement@11411} "org.springframework.aop.target.SimpleBeanTargetSource.getTarget(SimpleBeanTargetSource.java:35)"
3 = {java.lang.StackTraceElement@11412} "org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:187)"
4 = {java.lang.StackTraceElement@11413} "com.sun.proxy.$Proxy90.getAccessToken(Unknown Source)"
5 = {java.lang.StackTraceElement@11414} "org.springframework.security.oauth2.client.OAuth2RestTemplate.doExecute(OAuth2RestTemplate.java:125)"
6 = {java.lang.StackTraceElement@11415} "org.springframework.web.client.RestTemplate.execute(RestTemplate.java:530)"
7 = {java.lang.StackTraceElement@11416} "org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:476)"
8 = {java.lang.StackTraceElement@11417} "io.springbox.apigateway.services.reviews.ReviewsIntegrationService$1.invoke(ReviewsIntegrationService.java:28)"
9 = {java.lang.StackTraceElement@11418} "sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)"
10 = {java.lang.StackTraceElement@11419} "sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)"
11 = {java.lang.StackTraceElement@11420} "sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)"
12 = {java.lang.StackTraceElement@11421} "java.lang.reflect.Method.invoke(Method.java:483)"
13 = {java.lang.StackTraceElement@11422} "com.netflix.hystrix.contrib.javanica.command.MethodExecutionAction.execute(MethodExecutionAction.java:101)"
14 = {java.lang.StackTraceElement@11423} "com.netflix.hystrix.contrib.javanica.command.MethodExecutionAction.executeWithArgs(MethodExecutionAction.java:80)"
15 = {java.lang.StackTraceElement@11424} "com.netflix.hystrix.contrib.javanica.command.MethodExecutionAction.execute(MethodExecutionAction.java:66)"
16 = {java.lang.StackTraceElement@11425} "com.netflix.hystrix.contrib.javanica.command.GenericCommand$1.execute(GenericCommand.java:45)"
17 = {java.lang.StackTraceElement@11426} "com.netflix.hystrix.contrib.javanica.command.AbstractHystrixCommand.process(AbstractHystrixCommand.java:161)"
18 = {java.lang.StackTraceElement@11427} "com.netflix.hystrix.contrib.javanica.command.GenericCommand.run(GenericCommand.java:42)"
19 = {java.lang.StackTraceElement@11428} "com.netflix.hystrix.HystrixCommand$1.call(HystrixCommand.java:294)"
20 = {java.lang.StackTraceElement@11429} "com.netflix.hystrix.HystrixCommand$1.call(HystrixCommand.java:289)"
21 = {java.lang.StackTraceElement@11430} "rx.Observable$1.call(Observable.java:144)"
22 = {java.lang.StackTraceElement@11431} "rx.Observable$1.call(Observable.java:136)"
23 = {java.lang.StackTraceElement@11432} "rx.Observable$1.call(Observable.java:144)"
24 = {java.lang.StackTraceElement@11433} "rx.Observable$1.call(Observable.java:136)"
25 = {java.lang.StackTraceElement@11434} "rx.Observable$1.call(Observable.java:144)"
26 = {java.lang.StackTraceElement@11435} "rx.Observable$1.call(Observable.java:136)"
27 = {java.lang.StackTraceElement@11436} "rx.Observable.unsafeSubscribe(Observable.java:7466)"
28 = {java.lang.StackTraceElement@11437} "com.netflix.hystrix.AbstractCommand$5.call(AbstractCommand.java:518)"
29 = {java.lang.StackTraceElement@11438} "com.netflix.hystrix.AbstractCommand$5.call(AbstractCommand.java:501)"
30 = {java.lang.StackTraceElement@11439} "rx.Observable.unsafeSubscribe(Observable.java:7466)"
31 = {java.lang.StackTraceElement@11440} "rx.internal.operators.OperatorSubscribeOn$1$1.call(OperatorSubscribeOn.java:62)"
32 = {java.lang.StackTraceElement@11441} "com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:56)"
33 = {java.lang.StackTraceElement@11442} "com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:47)"
34 = {java.lang.StackTraceElement@11443} "com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction.call(HystrixContexSchedulerAction.java:69)"
35 = {java.lang.StackTraceElement@11444} "rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:47)"
36 = {java.lang.StackTraceElement@11445} "java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)"
37 = {java.lang.StackTraceElement@11446} "java.util.concurrent.FutureTask.run(FutureTask.java:266)"
38 = {java.lang.StackTraceElement@11447} "java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)"
39 = {java.lang.StackTraceElement@11448} "java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)"
40 = {java.lang.StackTraceElement@11449} "java.lang.Thread.run(Thread.java:745)"

Properly enable OAuth2 authorization on springbox-reviews

The io.springbox.reviews.controllers.ReviewController controller currently has 3 endpoints:

  1. GET /reviews
  2. GET /reviews/{mlId}
  3. POST /reviews

The first two endpoints should be accessible without authentication or authorization. The last endpoint should require a proper OAuth2 token.

build failure

I'm running maven 3.3.3, jdk1.8 on my centos7 (x86_64). This is failing in tests. Not sure if this is critical but anyone knows what I'm missing here?

Thanks

[INFO] Final Memory: 38M/504M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test (default-test) on project springbox-recommendations: There are test failures.
[ERROR]
[ERROR] Please refer to /root/spring-cloud-samples/springbox-cloud/springbox-recommendations/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test (default-test) on project springbox-recommendations: There are test failures.

Please refer to /root/spring-cloud-samples/springbox-cloud/springbox-recommendations/target/surefire-reports for the individual test results.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
total 596
drwxr-xr-x. 2 root root 4096 Jul 14 06:57 ./
drwxr-xr-x. 9 root root 4096 Jul 14 07:00 ../
-rw-r--r--. 1 root root 213001 Jul 14 07:00 io.springbox.recommendations.SpringboxRecommendationsApplicationTests.txt
-rw-r--r--. 1 root root 382215 Jul 14 07:00 TEST-io.springbox.recommendations.SpringboxRecommendationsApplicationTests.xml
...skipping...
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoFailureException: There are test failures.

Please refer to /root/spring-cloud-samples/springbox-cloud/springbox-recommendations/target/surefire-reports for the individual test results.
at org.apache.maven.plugin.surefire.SurefireHelper.reportExecution(SurefireHelper.java:82)
at org.apache.maven.plugin.surefire.SurefirePlugin.handleSummary(SurefirePlugin.java:195)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:861)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:729)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :springbox-recommendations

Clean up the AngularJS application

This code is currently in springbox-api-gateway/src/main/resources/static/js/hello.js.

Should be given a proper name obviously.

Also - I am not a strong JS or Angular developer, so this could use some general love from @scottfrederick.

Properly enable OAuth2 SSO and authorization on springbox-api-gateway

  1. @EnableOAuth2SSO (and associated config) is currently commented out on io.springbox.apigateway.SpringboxApiGatewayApplication.
  2. io.springbox.apigateway.controllers.ApiGatewayController has one endpoint, GET /movie/{mlId}, which should be OPEN. However, if a Principal is present, it will make a call to recommendationsIntegrationService.likes to determine if this movie is "liked" by the currently logged in user.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.