Search in sources :

Example 1 with FailedLoginDelayer

use of org.codice.ddf.security.common.FailedLoginDelayer in project ddf by codice.

the class TestUsernameTokenValidator method setup.

@Before
public void setup() {
    try {
        Credential credential = mock(Credential.class);
        when(niceValidator.validate(any(Credential.class), any(RequestData.class))).thenReturn(credential);
    } catch (WSSecurityException ignore) {
    //do nothing
    }
    failedLoginDelayer = mock(FailedLoginDelayer.class);
}
Also used : Credential(org.apache.wss4j.dom.validate.Credential) RequestData(org.apache.wss4j.dom.handler.RequestData) WSSecurityException(org.apache.wss4j.common.ext.WSSecurityException) FailedLoginDelayer(org.codice.ddf.security.common.FailedLoginDelayer) Before(org.junit.Before)

Example 2 with FailedLoginDelayer

use of org.codice.ddf.security.common.FailedLoginDelayer in project ddf by codice.

the class UPBSTValidatorTest method setup.

@Before
public void setup() {
    niceValidator.setContextName("realm");
    meanValidator.setContextName("realm");
    stsPropertiesMBean = mock(STSPropertiesMBean.class);
    when(stsPropertiesMBean.getSignatureCrypto()).thenReturn(new Merlin());
    when(stsPropertiesMBean.getCallbackHandler()).thenReturn(callbacks -> {
    });
    UPAuthenticationToken upAuthenticationToken = new UPAuthenticationToken("good", "password", "realm");
    BinarySecurityTokenType binarySecurityTokenType = new BinarySecurityTokenType();
    binarySecurityTokenType.setValueType(UPAuthenticationToken.UP_TOKEN_VALUE_TYPE);
    binarySecurityTokenType.setEncodingType(BSTAuthenticationToken.BASE64_ENCODING);
    binarySecurityTokenType.setId(UPAuthenticationToken.BST_USERNAME_LN);
    binarySecurityTokenType.setValue(upAuthenticationToken.getEncodedCredentials());
    upbstToken = new JAXBElement<>(new QName("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", "BinarySecurityToken"), BinarySecurityTokenType.class, binarySecurityTokenType);
    failedLoginDelayer = mock(FailedLoginDelayer.class);
}
Also used : STSPropertiesMBean(org.apache.cxf.sts.STSPropertiesMBean) BinarySecurityTokenType(org.apache.cxf.ws.security.sts.provider.model.secext.BinarySecurityTokenType) QName(javax.xml.namespace.QName) UPAuthenticationToken(org.codice.ddf.security.handler.api.UPAuthenticationToken) Merlin(org.apache.wss4j.common.crypto.Merlin) FailedLoginDelayer(org.codice.ddf.security.common.FailedLoginDelayer) Before(org.junit.Before)

Aggregations

FailedLoginDelayer (org.codice.ddf.security.common.FailedLoginDelayer)2 Before (org.junit.Before)2 QName (javax.xml.namespace.QName)1 STSPropertiesMBean (org.apache.cxf.sts.STSPropertiesMBean)1 BinarySecurityTokenType (org.apache.cxf.ws.security.sts.provider.model.secext.BinarySecurityTokenType)1 Merlin (org.apache.wss4j.common.crypto.Merlin)1 WSSecurityException (org.apache.wss4j.common.ext.WSSecurityException)1 RequestData (org.apache.wss4j.dom.handler.RequestData)1 Credential (org.apache.wss4j.dom.validate.Credential)1 UPAuthenticationToken (org.codice.ddf.security.handler.api.UPAuthenticationToken)1