Skip to content

Commit

Permalink
Got API Gateway working with auth server now. Auth server has in memo…
Browse files Browse the repository at this point in the history
…ry http and auth/token from password grant works
  • Loading branch information
Rohit Ghatol committed Apr 7, 2015
1 parent 125e3f7 commit 6e5cadc
Show file tree
Hide file tree
Showing 20 changed files with 218 additions and 24 deletions.
3 changes: 0 additions & 3 deletions api-gateway/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ dependencies {
compile("org.springframework.cloud:spring-cloud-starter-eureka:${project.cloudVersion}")
compile("org.springframework.cloud:spring-cloud-starter-zuul:${project.cloudVersion}")


compile("org.apache.tomcat.embed:tomcat-embed-jasper")

testCompile group: 'junit', name: 'junit', version: '4.+'
testCompile 'org.springframework:spring-test:4.0.6.RELEASE'
}
Expand Down
116 changes: 114 additions & 2 deletions auth-server/.classpath

Large diffs are not rendered by default.

Binary file modified auth-server/.gradle/2.3/taskArtifacts/cache.properties.lock
Binary file not shown.
Binary file modified auth-server/.gradle/2.3/taskArtifacts/fileHashes.bin
Binary file not shown.
Binary file modified auth-server/.gradle/2.3/taskArtifacts/fileSnapshots.bin
Binary file not shown.
Binary file modified auth-server/.gradle/2.3/taskArtifacts/outputFileStates.bin
Binary file not shown.
Binary file modified auth-server/.gradle/2.3/taskArtifacts/taskArtifacts.bin
Binary file not shown.
17 changes: 8 additions & 9 deletions auth-server/.project
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>auth-server</name>
<comment></comment>
<projects>
</projects>
<comment/>
<projects/>
<natures>
<nature>org.springsource.ide.eclipse.gradle.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
<arguments/>
</buildCommand>
</buildSpec>
<natures>
<nature>org.springsource.ide.eclipse.gradle.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<linkedResources/>
</projectDescription>
2 changes: 1 addition & 1 deletion auth-server/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
#Mon Apr 06 13:30:16 PDT 2015
#Tue Apr 07 12:01:04 PDT 2015
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
Expand Down
Empty file added auth-server/application.yml
Empty file.
6 changes: 6 additions & 0 deletions auth-server/bootstrap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
spring:
application:
name: auth-server
cloud:
config:
uri: http://localhost:8888
18 changes: 11 additions & 7 deletions auth-server/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
buildscript {
project.ext {
bootVersion = '1.1.4.RELEASE'
bootVersion = '1.2.3.RELEASE'
cloudVersion = '1.0.0.RELEASE'
seurityVersion = '2.0.7.RELEASE'
}
repositories {
mavenCentral()
Expand Down Expand Up @@ -30,12 +32,14 @@ repositories {
jcenter()
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web:1.1.4.RELEASE")
compile("org.springframework.boot:spring-boot-starter-data-jpa:1.1.4.RELEASE")
compile("org.springframework.boot:spring-boot-starter-actuator")

compile("org.apache.tomcat.embed:tomcat-embed-jasper")

compile("org.springframework.boot:spring-boot-starter-web:${project.bootVersion}")
compile("org.springframework.boot:spring-boot-starter-actuator:${project.bootVersion}")
compile("org.springframework.boot:spring-boot-starter-security:${project.bootVersion}")
compile("org.springframework.cloud:spring-cloud-config-client:${project.cloudVersion}")
compile("org.springframework.cloud:spring-cloud-starter-eureka:${project.cloudVersion}")
compile("org.springframework.security.oauth:spring-security-oauth2:${project.seurityVersion}")
compile("org.springframework.cloud:spring-cloud-starter-eureka:${project.cloudVersion}")

testCompile group: 'junit', name: 'junit', version: '4.+'
testCompile 'org.springframework:spring-test:4.0.6.RELEASE'
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/**
*
*/
package com.rohitghatol.microservice.auth;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer;
import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer;
import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer;


/**
* The Main Spring Boot Application class.
*
* @author rohitghatol
*/


@Configuration
@ComponentScan
@EnableAutoConfiguration
@EnableEurekaClient

public class Application {

/**
* The main method.
*
* @param args the arguments
*/
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}

/**
* The Class OAuth2Config.
*/
@Configuration
@EnableAuthorizationServer
protected static class OAuth2Config extends AuthorizationServerConfigurerAdapter {

/** The authentication manager. */
@Autowired
private AuthenticationManager authenticationManager;

/* (non-Javadoc)
* @see org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter#configure(org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer)
*/
@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
endpoints.authenticationManager(authenticationManager);
}

/* (non-Javadoc)
* @see org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter#configure(org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer)
*/
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
clients.inMemory()
.withClient("client")
.authorizedGrantTypes("client_credentials","refresh_token", "password")
.authorities("ROLE_CLIENT")
.scopes("read")
.resourceIds("paywize")
.secret("secret");
}
}

}
Binary file modified task-webservice/.gradle/2.3/taskArtifacts/cache.properties.lock
Binary file not shown.
Binary file modified task-webservice/.gradle/2.3/taskArtifacts/fileHashes.bin
Binary file not shown.
Binary file modified task-webservice/.gradle/2.3/taskArtifacts/fileSnapshots.bin
Binary file not shown.
Binary file modified task-webservice/.gradle/2.3/taskArtifacts/outputFileStates.bin
Binary file not shown.
Binary file modified task-webservice/.gradle/2.3/taskArtifacts/taskArtifacts.bin
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import com.rohitghatol.microservices.task.dtos.TaskDTO;

@RestController
@RequestMapping("/task")
@RequestMapping("/")
public class TaskController {

private List<TaskDTO> tasks = new ArrayList<TaskDTO>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import com.rohitghatol.microservices.user.dto.UserDTO;

@RestController
@RequestMapping("/user")
@RequestMapping("/")
public class UserController {

@Value("${mail.domain}")
Expand Down

0 comments on commit 6e5cadc

Please sign in to comment.