This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {useEffect, useLayoutEffect, useRef, useState} from 'react'; | |
import {Button,CircularProgress,CssBaseline,TextField,Grid,Container,Theme,makeStyles,Box,FormHelperText,SnackbarContent,Snackbar,Icon,IconButton} from '@material-ui/core'; | |
/*import Link from '@material-ui/core/Link';*/ | |
/*import {makeStyles} from '@material-ui/core/styles';*/ | |
import defaultTheme from '../src/theme'; | |
import {ThemeProvider} from '@material-ui/styles'; | |
import Logo from "../src/components/logo"; | |
import {PasswordDto, RecaptchaDto, SignInDto, UserDto} from "../models/SignInDto"; | |
import {NextPage} from "next"; | |
import '../styles/signin.scss'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {useEffect, useLayoutEffect, useRef, useState} from 'react'; | |
import {Button,CircularProgress,CssBaseline,TextField,Grid,Container,Theme,makeStyles,Box,FormHelperText,SnackbarContent,Snackbar,Icon,IconButton} from '@material-ui/core'; | |
/*import Link from '@material-ui/core/Link';*/ | |
/*import {makeStyles} from '@material-ui/core/styles';*/ | |
import defaultTheme from '../src/theme'; | |
import {ThemeProvider} from '@material-ui/styles'; | |
import Logo from "../src/components/logo"; | |
import {PasswordDto, RecaptchaDto, RegisterDto, UserDto, RePasswordDto} from "../models/RegisterDto"; | |
import {NextPage} from "next"; | |
import '../styles/signin.scss'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
NOTES | |
replace your http://your.oauth.server.domain/oauth/token with actual token url for your oauth server | |
replace your_client_id with actual client id of your oauth server | |
replace your_client_secret with actual client secret of your oauth server | |
replace "your scopes space seperated" with actual scopes | |
*/ | |
const postRequest = { | |
url: "http://your.oauth.server.domain/oauth/token", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function JSONStringify(object) { | |
var cache:any[] = []; | |
var str = JSON.stringify(object, | |
// custom replacer fxn - gets around "TypeError: Converting circular structure to JSON" | |
function(key, value) { | |
if (typeof value === 'object' && value !== null) { | |
if (cache.indexOf(value) !== -1) { | |
// Circular reference found, discard key | |
return; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"aud": [ | |
"neuw_api_resources" | |
], | |
"scope": [ | |
"system" | |
], | |
"iss": "http://localhost:8080", | |
"scopes": "system", | |
"exp": 1586855599, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"aud": [ | |
"mock_aud" | |
], | |
"scope": [ | |
"system" | |
], | |
"iss": "http://localhost:8080", | |
"scopes": "system", | |
"exp": 1586855599, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-oauth2-resource-server</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework.security</groupId> | |
<artifactId>spring-security-oauth2-jose</artifactId> | |
</dependency> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class JKStoBase64String { | |
private static final int BUFFER_SIZE = 65535; | |
public static byte[] convertFileToByteArray(String certificateFilePath) throws Exception { | |
if (certificateFilePath == null || certificateFilePath.isEmpty()) { | |
throw new Exception("file path should not be null or empty"); | |
} | |
File file = new File(certificateFilePath); | |
if (!file.exists()) { | |
throw new Exception("file not exist : " + file.getAbsolutePath()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\--oauth2-spring-boot-client - Root | |
| .gitignore - Git management for ignoring not required files | |
| pom.xml - Maven pom.xml | |
+---src | |
| +---main | |
| | +---java | |
| | | \---in | |
| | | \---neuw | |
| | | \---oauth2 | |
| | | | Oauth2SpringBootClientApplication.java - The SpringBootApplication main class. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
public class TestClientConfig { | |
@Value("${test.client.base.url}") | |
private String testClientBaseUrl; | |
private Logger testWebClientLogger = LoggerFactory.getLogger("TEST_WEB_CLIENT"); | |
/** | |
* The authorizedClientManager for required by the webClient |
OlderNewer