Skip to content

Commit

Permalink
Merge branch 'keycloak-integration' of github.com:NCI-Agency/anet int…
Browse files Browse the repository at this point in the history
…o anet-v2_2
  • Loading branch information
VassilIordanov committed May 18, 2020
2 parents cb18cf8 + 8d9faf3 commit 16e5af2
Show file tree
Hide file tree
Showing 20 changed files with 2,377 additions and 684 deletions.
2,032 changes: 2,032 additions & 0 deletions ANET-Realm-export.json

Large diffs are not rendered by default.

29 changes: 11 additions & 18 deletions anet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
##############################################################

# Flag to run the server in development mode
# - Will use Basic authentication (rather than Windows Domain Auth)
# - Will reload the GraphQL Graph on every request.
# - Will run the account deactivation worker once on startup
developmentMode: true

# Flag to tell the server to redirect all HTTP traffic to HTTPS
Expand Down Expand Up @@ -51,20 +50,16 @@ emailFromAddr: "Anet Testing <[email protected]>"
# Should not include an ending slash!
serverUrl: "http://localhost:3000"

# Whether to time Waffle requests
timeWaffleRequests: true

# Configuration for Waffle. This is the system that ANET uses to perform windows authentication
# See https://github.com/Waffle/waffle
waffleConfig:
principalFormat: fqn
roleFormat: both
allowGuestLogin: false
impersonate: false
securityFilterProviders: waffle.servlet.spi.BasicSecurityFilterProvider
#securityFilterProviders: "waffle.servlet.spi.BasicSecurityFilterProvider waffle.servlet.spi.NegotiateSecurityFilterProvider"
#"waffle.servlet.spi.NegotiateSecurityFilterProvider/protocols": NTLM
"waffle.servlet.spi.BasicSecurityFilterProvider/realm": ANET
keycloakConfiguration:
realm: ANET-Realm
auth-server-url: http://localhost:9080/auth
ssl-required: none
register-node-at-startup: true
register-node-period: 600
resource: ANET-Client
enable-basic-auth: true
credentials:
secret: 12869b4c-74ac-43f9-b71e-ff74e07babf9

########################################################
### The below is the default Dropwizard Configuration
Expand Down Expand Up @@ -139,8 +134,6 @@ logging:
logFormat: '%d{yyyy-MM-dd HH:mm:ss.SSS,UTC}\t%p\t%m%n'
"io.dropwizard.assets.AssetsBundle" : TRACE
"io.dropwizard.assets.*" : TRACE
"waffle.servlet.NegotiateSecurityFilter" : TRACE
"mil.dds.anet.auth.AnetAuthenticationFilter" : TRACE
"mil.dds.anet.threads" : DEBUG
"mil.dds.anet.resources.TestingResource" :
level: INFO
Expand Down
6 changes: 4 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
id "org.kordamp.markdown.convert" version "1.2.0"
id "com.bmuschko.docker-remote-api" version "6.4.0"
id "com.github.node-gradle.node" version "2.2.3"
id "com.diffplug.gradle.spotless" version "3.29.0"
id "com.diffplug.gradle.spotless" version "3.30.0"
}

apply plugin: 'java'
Expand Down Expand Up @@ -85,12 +85,14 @@ dependencies {
implementation 'ch.qos.logback:logback-classic:1.2.3'
implementation 'ch.qos.logback:logback-core:1.2.3'
implementation 'ch.qos.logback:logback-access:1.2.3'
implementation 'com.github.waffle:waffle-jna:1.9.1'
implementation 'com.graphql-java:java-dataloader:2.2.3'
implementation 'io.leangen.graphql:spqr:0.10.1'
implementation 'com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer:20191001.1'
implementation 'com.mikesamuel:json-sanitizer:1.2.0'

// Authentication
implementation 'de.ahus1.keycloak.dropwizard:keycloak-dropwizard:1.1.1'

// Used for converting GraphQL request output to XML:
implementation 'com.github.javadev:underscore-lodash:1.26'
// For JSON schema validation
Expand Down
2 changes: 1 addition & 1 deletion client/config/browserstack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const capabilities = {
// but that is so prone to unexpected failures as to be unusable.
// So test with latest stable Chrome instead.
browserName: "Chrome",
browser_version: "80.0",
browser_version: "81.0",
"goog:chromeOptions": {
// Maximize the window so we can see what's going on
args: ["--start-maximized"]
Expand Down
16 changes: 8 additions & 8 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
"@storybook/addon-actions": "5.3.18",
"@storybook/react": "5.3.18",
"@wdio/browserstack-service": "6.1.10",
"@wdio/cli": "6.1.9",
"@wdio/local-runner": "6.1.9",
"@wdio/cli": "6.1.11",
"@wdio/local-runner": "6.1.11",
"@wdio/mocha-framework": "6.1.8",
"@wdio/spec-reporter": "6.1.9",
"@wdio/sync": "6.1.8",
Expand All @@ -42,7 +42,7 @@
"cache-loader": "4.1.0",
"chai": "4.2.0",
"chalk": "4.0.0",
"chromedriver": "80.0.2",
"chromedriver": "81.0.0",
"clean-webpack-plugin": "3.0.0",
"colors": "1.4.0",
"config": "3.3.1",
Expand All @@ -52,7 +52,7 @@
"cross-spawn": "7.0.2",
"css-loader": "3.5.3",
"dotenv": "8.2.0",
"eslint": "6.8.0",
"eslint": "7.0.0",
"eslint-config-react-app": "5.2.1",
"eslint-config-standard": "14.1.1",
"eslint-config-standard-react": "9.2.0",
Expand All @@ -63,7 +63,7 @@
"eslint-plugin-node": "11.1.0",
"eslint-plugin-promise": "4.2.1",
"eslint-plugin-react": "7.19.0",
"eslint-plugin-react-hooks": "3.0.0",
"eslint-plugin-react-hooks": "4.0.0",
"eslint-plugin-standard": "4.0.1",
"faker": "https://github.com/Marak/faker.js.git",
"file-loader": "6.0.0",
Expand All @@ -87,7 +87,7 @@
"style-loader": "1.2.1",
"thread-loader": "2.1.3",
"wdio-chromedriver-service": "6.0.3",
"webdriverio": "6.1.9",
"webdriverio": "6.1.11",
"webpack": "4.43.0",
"webpack-cli": "3.3.11",
"webpack-dev-server": "3.11.0",
Expand Down Expand Up @@ -144,11 +144,11 @@
"react-redux": "7.2.0",
"react-redux-loading-bar": "4.6.0",
"react-router-bootstrap": "0.25.0",
"react-router-dom": "5.1.2",
"react-router-dom": "5.2.0",
"react-scroll": "1.7.16",
"react-svg-text": "0.1.2",
"react-tag-input": "6.4.2",
"react-toastify": "5.5.0",
"react-toastify": "6.0.2",
"react-tooltip": "4.2.6",
"react-ultimate-pagination": "1.2.0",
"react-use-dimensions": "1.2.1",
Expand Down
50 changes: 37 additions & 13 deletions client/src/pages/Help.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,28 +42,18 @@ const BaseHelp = ({ appSettings, currentUser, pageDispatchers }) => {
currentUser.position &&
currentUser.position.organization
) {
// Retrieve super users
const positionQuery = {
pageSize: 0, // retrieve all these positions
type: [Position.TYPE.SUPER_USER, Position.TYPE.ADMINISTRATOR],
status: Position.STATUS.ACTIVE,
organizationUuid: currentUser.position.organization.uuid
}
const queryResult = API.useApiQuery(GQL_GET_POSITION_LIST, {
positionQuery
})
return (
<BaseHelpConditional
<BaseHelpFetchSuperUsers
orgUuid={currentUser.position.organization.uuid}
appSettings={appSettings}
currentUser={currentUser}
pageDispatchers={pageDispatchers}
{...queryResult}
orgUuid={currentUser.position.organization.uuid}
/>
)
}
return (
<BaseHelpConditional
appSettings={appSettings}
currentUser={currentUser}
pageDispatchers={pageDispatchers}
/>
Expand All @@ -76,6 +66,40 @@ BaseHelp.propTypes = {
pageDispatchers: PageDispatchersPropType
}

const BaseHelpFetchSuperUsers = ({
orgUuid,
appSettings,
currentUser,
pageDispatchers
}) => {
// Retrieve super users
const positionQuery = {
pageSize: 0, // retrieve all these positions
type: [Position.TYPE.SUPER_USER, Position.TYPE.ADMINISTRATOR],
status: Position.STATUS.ACTIVE,
organizationUuid: orgUuid
}
const queryResult = API.useApiQuery(GQL_GET_POSITION_LIST, {
positionQuery
})
return (
<BaseHelpConditional
appSettings={appSettings}
currentUser={currentUser}
pageDispatchers={pageDispatchers}
{...queryResult}
orgUuid={orgUuid}
/>
)
}

BaseHelpFetchSuperUsers.propTypes = {
orgUuid: PropTypes.string.isRequired,
appSettings: PropTypes.object,
currentUser: PropTypes.instanceOf(Person),
pageDispatchers: PageDispatchersPropType
}

const BaseHelpConditional = ({
loading,
error,
Expand Down
26 changes: 20 additions & 6 deletions client/src/pages/organizations/New.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,10 @@ const OrganizationNew = ({ pageDispatchers }) => {
const routerLocation = useLocation()
const qs = utils.parseQueryString(routerLocation.search)
if (qs.parentOrgUuid) {
const queryResult = API.useApiQuery(GQL_GET_ORGANIZATION, {
uuid: qs.parentOrgUuid
})
return (
<OrganizationNewConditional
pageDispatchers={pageDispatchers}
{...queryResult}
<OrganizationNewFetchParentOrg
orgUuid={qs.parentOrgUuid}
pageDispatchers={pageDispatchers}
/>
)
}
Expand All @@ -48,6 +44,24 @@ OrganizationNew.propTypes = {
pageDispatchers: PageDispatchersPropType
}

const OrganizationNewFetchParentOrg = ({ orgUuid, pageDispatchers }) => {
const queryResult = API.useApiQuery(GQL_GET_ORGANIZATION, {
uuid: orgUuid
})
return (
<OrganizationNewConditional
pageDispatchers={pageDispatchers}
{...queryResult}
orgUuid={orgUuid}
/>
)
}

OrganizationNewFetchParentOrg.propTypes = {
orgUuid: PropTypes.string.isRequired,
pageDispatchers: PageDispatchersPropType
}

const OrganizationNewConditional = ({
loading,
error,
Expand Down
30 changes: 22 additions & 8 deletions client/src/pages/positions/New.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,10 @@ const PositionNew = ({ pageDispatchers }) => {
const routerLocation = useLocation()
const qs = utils.parseQueryString(routerLocation.search)
if (qs.organizationUuid) {
// If an organizationUuid was given in query parameters,
// then look that org up and pre-populate the field.
const queryResult = API.useApiQuery(GQL_GET_ORGANIZATION, {
uuid: qs.organizationUuid
})
return (
<PositionNewConditional
pageDispatchers={pageDispatchers}
{...queryResult}
<PositionNewFetchOrg
orgUuid={qs.organizationUuid}
pageDispatchers={pageDispatchers}
/>
)
}
Expand All @@ -50,6 +44,26 @@ PositionNew.propTypes = {
pageDispatchers: PageDispatchersPropType
}

const PositionNewFetchOrg = ({ orgUuid, pageDispatchers }) => {
// If an organizationUuid was given in query parameters,
// then look that org up and pre-populate the field.
const queryResult = API.useApiQuery(GQL_GET_ORGANIZATION, {
uuid: orgUuid
})
return (
<PositionNewConditional
pageDispatchers={pageDispatchers}
{...queryResult}
orgUuid={orgUuid}
/>
)
}

PositionNewFetchOrg.propTypes = {
orgUuid: PropTypes.string.isRequired,
pageDispatchers: PageDispatchersPropType
}

const PositionNewConditional = ({
loading,
error,
Expand Down
26 changes: 20 additions & 6 deletions client/src/pages/tasks/New.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,10 @@ const TaskNew = ({ pageDispatchers }) => {
const routerLocation = useLocation()
const qs = utils.parseQueryString(routerLocation.search)
if (qs.taskedOrgUuid) {
const queryResult = API.useApiQuery(GQL_GET_ORGANIZATION, {
uuid: qs.taskedOrgUuid
})
return (
<TaskNewConditional
<TaskNewFetchTaskedOrg
taskedOrgUuid={qs.taskedOrgUuid}
pageDispatchers={pageDispatchers}
{...queryResult}
orgUuid={qs.taskedOrgUuid}
/>
)
}
Expand All @@ -48,6 +44,24 @@ TaskNew.propTypes = {
pageDispatchers: PageDispatchersPropType
}

const TaskNewFetchTaskedOrg = ({ taskedOrgUuid, pageDispatchers }) => {
const queryResult = API.useApiQuery(GQL_GET_ORGANIZATION, {
uuid: taskedOrgUuid
})
return (
<TaskNewConditional
pageDispatchers={pageDispatchers}
{...queryResult}
orgUuid={taskedOrgUuid}
/>
)
}

TaskNewFetchTaskedOrg.propTypes = {
taskedOrgUuid: PropTypes.string.isRequired,
pageDispatchers: PageDispatchersPropType
}

const TaskNewConditional = ({
loading,
error,
Expand Down
Loading

0 comments on commit 16e5af2

Please sign in to comment.