forked from apereo/cas
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support confirming risky authentication attempts
- Loading branch information
Showing
45 changed files
with
828 additions
and
264 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Security Vulnerability Response | ||
Please review [this](https://apereo.github.io/cas/developer/Sec-Vuln-Response.html). |
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
30 changes: 30 additions & 0 deletions
30
...pereo/cas/support/events/authentication/adaptive/CasRiskyAuthenticationVerifiedEvent.java
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,30 @@ | ||
package org.apereo.cas.support.events.authentication.adaptive; | ||
|
||
import org.apereo.cas.support.events.AbstractCasEvent; | ||
import lombok.Getter; | ||
import lombok.ToString; | ||
import org.apereo.inspektr.common.web.ClientInfo; | ||
import java.io.Serial; | ||
|
||
/** | ||
* This is {@link CasRiskyAuthenticationVerifiedEvent}. | ||
* | ||
* @author Misagh Moayyed | ||
* @since 5.1.0 | ||
*/ | ||
@ToString(callSuper = true) | ||
@Getter | ||
public class CasRiskyAuthenticationVerifiedEvent extends AbstractCasEvent { | ||
|
||
@Serial | ||
private static final long serialVersionUID = 291168297497263298L; | ||
|
||
private final String riskToken; | ||
|
||
public CasRiskyAuthenticationVerifiedEvent(final Object source, | ||
final ClientInfo clientInfo, | ||
final String riskToken) { | ||
super(source, clientInfo); | ||
this.riskToken = riskToken; | ||
} | ||
} |
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
5 changes: 5 additions & 0 deletions
5
ci/tests/puppeteer/scenarios/electrofence-login-risk-verification/email.gtemplate
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,5 @@ | ||
------------------------------------ | ||
Dear ${authentication.principal.id}. | ||
------------------------------------ | ||
|
||
link=${verificationUrl} |
28 changes: 28 additions & 0 deletions
28
ci/tests/puppeteer/scenarios/electrofence-login-risk-verification/script.js
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,28 @@ | ||
const puppeteer = require('puppeteer'); | ||
const cas = require('../../cas.js'); | ||
const assert = require("assert"); | ||
|
||
(async () => { | ||
const browser = await puppeteer.launch(cas.browserOptions()); | ||
const page = await cas.newPage(browser); | ||
let service = "https://localhost:9859/anything/adaptive"; | ||
await cas.goto(page, `https://localhost:8443/cas/login?service=${service}`); | ||
await page.waitForTimeout(1000); | ||
await cas.loginWith(page, "casuser", "Mellon"); | ||
await page.waitForTimeout(1000); | ||
await cas.assertInnerTextContains(page, "#loginErrorsPanel p", "authentication attempt is determined to be risky"); | ||
|
||
await cas.goto(page, "http://localhost:8282"); | ||
await page.waitForTimeout(5000); | ||
await cas.click(page, "table tbody td a"); | ||
await page.waitForTimeout(1000); | ||
let body = await cas.textContent(page, "div[name=bodyPlainText] .well"); | ||
console.log(`Email message body is: ${body}`); | ||
const link = body.substring(body.indexOf("link=") + 5); | ||
await cas.logg(`Verification link is ${link}`); | ||
let response = await cas.goto(page, link); | ||
console.log(`${response.status()} ${response.statusText()}`); | ||
assert(response.ok()); | ||
await cas.assertInnerText(page, "#content h2", "Risky Authentication attempt is confirmed."); | ||
await browser.close(); | ||
})(); |
37 changes: 37 additions & 0 deletions
37
ci/tests/puppeteer/scenarios/electrofence-login-risk-verification/script.json
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,37 @@ | ||
{ | ||
"dependencies": "events-memory,electrofence,geolocation", | ||
"conditions": { | ||
"docker": "true" | ||
}, | ||
"properties": [ | ||
"--cas.server.name=https://localhost:8443", | ||
"--cas.server.prefix=${cas.server.name}/cas", | ||
|
||
"--cas.authn.attribute-repository.stub.attributes.phone=13477464523", | ||
"--cas.authn.attribute-repository.stub.attributes.mail=casuser@example.org", | ||
|
||
"--cas.http-client.host-name-verifier=none", | ||
"--cas.audit.slf4j.use-single-line=true", | ||
|
||
"--cas.authn.adaptive.risk.core.threshold=0.2", | ||
"--cas.authn.adaptive.risk.ip.enabled=true", | ||
|
||
"--cas.service-registry.core.init-from-json=true", | ||
|
||
"--spring.mail.host=localhost", | ||
"--spring.mail.port=25000", | ||
|
||
"--cas.webflow.crypto.signing.key=v43dwqO_GbGSVsFqgPFpVdwdMSEunMUzc4QSF13x18kInHPeRuvntleljO5Y5cKqDGAFe1vv10mM4tpyoKyBBA", | ||
"--cas.webflow.crypto.encryption.key=2PikjfOKY6n8Bbux2cy-Hg", | ||
|
||
"--cas.tgc.crypto.encryption.key=u696jJnPvm1DHLR7yVCSKMMzzoPoFxJZW4-MP1CkM5w", | ||
"--cas.tgc.crypto.signing.key=zPdNCd0R1oMR0ClzEqZzapkte8rO0tNvygYjmHoUhitAu6CBscwMC3ZTKy8tleTKiQ6GVcuiQQgxfd1nSKxf7w", | ||
|
||
"--cas.authn.adaptive.risk.response.mail.html=false", | ||
"[email protected]", | ||
"--cas.authn.adaptive.risk.response.mail.subject=CasRiskyAuthN", | ||
"--cas.authn.adaptive.risk.response.mail.text=file:${PWD}/ci/tests/puppeteer/scenarios/${SCENARIO}/email.gtemplate" | ||
], | ||
"jvmArgs": "-Djava.net.preferIPv4Addresses=true", | ||
"initScript": "${PWD}/ci/tests/mail/run-mail-server.sh,${PWD}/ci/tests/httpbin/run-httpbin-server.sh" | ||
} |
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
Oops, something went wrong.