Compare commits

..

No commits in common. "b0e2f0e25b8aa8b3f2ed11f2cdf3d9d47c2697f1" and "db3cf0ee29ac4d7127f082d0c351ad4f8771ba7c" have entirely different histories.

4 changed files with 8 additions and 59 deletions

View File

@ -16,13 +16,12 @@ repositories {
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-security'
//implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-webflux'
implementation 'org.apache.httpcomponents.client5:httpclient5:5.2.1'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'io.projectreactor:reactor-test'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
//testImplementation 'org.springframework.security:spring-security-test'
}

View File

@ -1,6 +1,5 @@
package djmil.cordacheckers;
import java.security.Principal;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
@ -27,14 +26,4 @@ public class ApiController {
return ResponseEntity.ok(joke);
}
/**
*
* @return a Json list of active games
*/
@GetMapping("/api/activegames")
public ResponseEntity<String> dashboard(Principal principal) {
return ResponseEntity.ok("{ \"ActiveGames\" : [\"game\", \"GAME\", \""+principal.getName()+ "\" ] }" );
}
}

View File

@ -1,38 +0,0 @@
package djmil.cordacheckers;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.provisioning.InMemoryUserDetailsManager;
@Configuration
public class SecurityConfig {
@Bean
PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
@Bean
UserDetailsService hardcodedCordaUsers(PasswordEncoder passwordEncoder) {
User.UserBuilder users = User.builder();
UserDetails alice = users
.username("alice")
.password(passwordEncoder.encode("qaz123"))
.build();
UserDetails bob = users
.username("bob")
.password(passwordEncoder.encode("qaz123"))
.build();
return new InMemoryUserDetailsManager(alice, bob);
}
}

View File

@ -3,15 +3,14 @@ import React, { useState, useEffect } from 'react';
function App() {
const [activeGames, setActiveGames] = useState(null);
const [joke, setJoke] = useState(null);
useEffect(() => {
fetch('/api/activegames')
fetch('/api/badjokes')
.then((response) => response.json())
.then((games) => {
console.log(games.ActiveGames.length);
console.log("games: " +games.ActiveGames);
setActiveGames(games.ActiveGames);
.then((data) => {
console.log(data.joke);
setJoke(data.joke);
})
.catch((err) => {
console.log(err.message);
@ -22,7 +21,7 @@ function App() {
<div className="App">
<header className="App-header">
<p>
Here is list of your active games: {activeGames ? <span>{activeGames}</span> : <span>Loading...</span>}
Here is your joke: {joke ? <span>{joke}</span> : <span>Loading...</span>}
</p>
</header>
</div>