mirror of
https://github.com/ditkrg/AuthorizationServerDemos.git
synced 2026-01-22 22:47:02 +00:00
Changes https to http
This commit is contained in:
parent
f993d6f0d0
commit
2108f993bf
@ -17,7 +17,7 @@
|
|||||||
"tailwindcss": "^2.0.2"
|
"tailwindcss": "^2.0.2"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "HTTPS=true react-scripts start",
|
"start": "react-scripts start",
|
||||||
"build": "react-scripts build",
|
"build": "react-scripts build",
|
||||||
"test": "react-scripts test",
|
"test": "react-scripts test",
|
||||||
"eject": "react-scripts eject"
|
"eject": "react-scripts eject"
|
||||||
|
|||||||
@ -1,46 +1,48 @@
|
|||||||
import { UserManager } from 'oidc-client';
|
import { UserManager } from "oidc-client";
|
||||||
import { storeUserError, storeUser } from '../actions/authActions'
|
import { storeUserError, storeUser } from "../actions/authActions";
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
authority: "https://localhost:10000",
|
authority: "http://localhost:10000",
|
||||||
client_id: "traffic-police-react-app",
|
client_id: "traffic-police-react-app",
|
||||||
redirect_uri: "https://localhost:3000/signin-oidc",
|
redirect_uri: "http://localhost:3000/signin-oidc",
|
||||||
response_type: "code",
|
response_type: "code",
|
||||||
scope: "openid profile traffic-police-api",
|
scope: "openid profile traffic-police-api",
|
||||||
post_logout_redirect_uri: "https://localhost:3000/signout-oidc",
|
post_logout_redirect_uri: "http://localhost:3000/signout-oidc",
|
||||||
};
|
};
|
||||||
|
|
||||||
const userManager = new UserManager(config)
|
const userManager = new UserManager(config);
|
||||||
|
|
||||||
export async function loadUserFromStorage(store) {
|
export async function loadUserFromStorage(store) {
|
||||||
try {
|
try {
|
||||||
let user = await userManager.getUser()
|
let user = await userManager.getUser();
|
||||||
if (!user) { return store.dispatch(storeUserError()) }
|
if (!user) {
|
||||||
store.dispatch(storeUser(user))
|
return store.dispatch(storeUserError());
|
||||||
|
}
|
||||||
|
store.dispatch(storeUser(user));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(`User not found: ${e}`)
|
console.error(`User not found: ${e}`);
|
||||||
store.dispatch(storeUserError())
|
store.dispatch(storeUserError());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function signinRedirect() {
|
export function signinRedirect() {
|
||||||
return userManager.signinRedirect()
|
return userManager.signinRedirect();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function signinRedirectCallback() {
|
export function signinRedirectCallback() {
|
||||||
return userManager.signinRedirectCallback()
|
return userManager.signinRedirectCallback();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function signoutRedirect() {
|
export function signoutRedirect() {
|
||||||
userManager.clearStaleState()
|
userManager.clearStaleState();
|
||||||
userManager.removeUser()
|
userManager.removeUser();
|
||||||
return userManager.signoutRedirect()
|
return userManager.signoutRedirect();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function signoutRedirectCallback() {
|
export function signoutRedirectCallback() {
|
||||||
userManager.clearStaleState()
|
userManager.clearStaleState();
|
||||||
userManager.removeUser()
|
userManager.removeUser();
|
||||||
return userManager.signoutRedirectCallback()
|
return userManager.signoutRedirectCallback();
|
||||||
}
|
}
|
||||||
|
|
||||||
export default userManager
|
export default userManager;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user