forked from blcham/record-manager-ui
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from akaene/main
[23ava-distribution#6] Support OAuth2
- Loading branch information
Showing
27 changed files
with
484 additions
and
120 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
RECORD_MANAGER_API_URL=http://localhost:8080/record-manager | ||
RECORD_MANAGER_APP_TITLE=OFN Record Manager | ||
RECORD_MANAGER_DEV_SERVER_PORT=3000 | ||
RECORD_MANAGER_PROD_SERVER_PORT=8080 | ||
RECORD_MANAGER_LANGUAGE=en | ||
RECORD_MANAGER_NAVIGATOR_LANGUAGE=false | ||
RECORD_MANAGER_BASENAME=/record-manager | ||
RECORD_MANAGER_EXTENSIONS= | ||
RECORD_MANAGER_AUTHENTICATION=internal | ||
RECORD_MANAGER_AUTH_SERVER_URL= | ||
RECORD_MANAGER_AUTH_CLIENT_ID= |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,6 @@ | |
"plugin:react/recommended" | ||
], | ||
"rules": { | ||
|
||
"react/prop-types": "off" | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.idea | ||
*.iml | ||
node_modules | ||
build | ||
coverage | ||
junit.xml | ||
.DS_store |
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
module.exports = { | ||
"plugins": [ | ||
"lodash", | ||
"@babel/plugin-proposal-class-properties", | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,24 @@ | ||
'use strict'; | ||
|
||
import React from "react"; | ||
import withI18n from "../../i18n/withI18n"; | ||
import {injectIntl} from "react-intl"; | ||
import {connect} from "react-redux"; | ||
import {bindActionCreators} from "redux"; | ||
import React, {useContext} from "react"; | ||
import {useDispatch} from "react-redux"; | ||
import {logout} from "../../actions/AuthActions"; | ||
import {transitionTo} from "../../utils/Routing"; | ||
import Routes from "../../constants/RoutesConstants"; | ||
import {isUsingOidcAuth} from "../../utils/OidcUtils"; | ||
import {AuthContext} from "../misc/oidc/OidcAuthWrapper"; | ||
|
||
class Logout extends React.Component { | ||
componentDidMount() { | ||
this.props.logout(); | ||
transitionTo(Routes.login); | ||
} | ||
const Logout = () => { | ||
const dispatch = useDispatch(); | ||
const authCtx = useContext(AuthContext); | ||
React.useEffect(() => { | ||
if (isUsingOidcAuth()) { | ||
authCtx.logout(); | ||
} | ||
dispatch(logout()).then(() => { | ||
transitionTo(Routes.login); | ||
}); | ||
}); | ||
|
||
render() { | ||
return null; | ||
} | ||
return null; | ||
} | ||
|
||
export default connect(null, mapDispatchToProps)(injectIntl(withI18n(Logout))); | ||
|
||
function mapDispatchToProps(dispatch) { | ||
return { | ||
logout: bindActionCreators(logout, dispatch) | ||
} | ||
} | ||
export default Logout; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React from "react"; | ||
import {isUsingOidcAuth} from "../../../utils/OidcUtils"; | ||
|
||
const IfInternalAuth = ({ children }) => { | ||
if (isUsingOidcAuth()) { | ||
return null; | ||
} | ||
return <>{children}</>; | ||
}; | ||
|
||
export default IfInternalAuth; |
Oops, something went wrong.