Search in sources :

Example 1 with EncodedUsernamePasswordPrincipal

use of org.wildfly.extension.camel.security.EncodedUsernamePasswordPrincipal in project wildfly-camel by wildfly-extras.

the class SecuredSpringRouteTestCase method getAuthenticationToken.

Subject getAuthenticationToken(String domain, String username, String password) {
    Subject subject = new Subject();
    subject.getPrincipals().add(new DomainPrincipal(domain));
    subject.getPrincipals().add(new EncodedUsernamePasswordPrincipal(username, password.toCharArray()));
    return subject;
}
Also used : DomainPrincipal(org.wildfly.extension.camel.security.DomainPrincipal) EncodedUsernamePasswordPrincipal(org.wildfly.extension.camel.security.EncodedUsernamePasswordPrincipal) Subject(javax.security.auth.Subject)

Example 2 with EncodedUsernamePasswordPrincipal

use of org.wildfly.extension.camel.security.EncodedUsernamePasswordPrincipal in project wildfly-camel by wildfly-extras.

the class AnnotatedSLSB method secureRouteAccess.

@RolesAllowed({ "Role2" })
public String secureRouteAccess(String msg) {
    // [TODO #725] Add support for security context propagation
    Subject subject = new Subject();
    String username = ejbctx.getCallerPrincipal().getName();
    subject.getPrincipals().add(new DomainPrincipal("user-domain"));
    subject.getPrincipals().add(new EncodedUsernamePasswordPrincipal(username, PASSWORD.toCharArray()));
    ProducerTemplate producer = camelctx.createProducerTemplate();
    return producer.requestBodyAndHeader("direct:start", msg, Exchange.AUTHENTICATION, subject, String.class);
}
Also used : ProducerTemplate(org.apache.camel.ProducerTemplate) DomainPrincipal(org.wildfly.extension.camel.security.DomainPrincipal) EncodedUsernamePasswordPrincipal(org.wildfly.extension.camel.security.EncodedUsernamePasswordPrincipal) Subject(javax.security.auth.Subject) RolesAllowed(javax.annotation.security.RolesAllowed)

Example 3 with EncodedUsernamePasswordPrincipal

use of org.wildfly.extension.camel.security.EncodedUsernamePasswordPrincipal in project wildfly-camel by wildfly-extras.

the class ClientLoginIntegrationTest method getAuthenticationToken.

Subject getAuthenticationToken(String domain, String username, String password) {
    Subject subject = new Subject();
    subject.getPrincipals().add(new DomainPrincipal(domain));
    subject.getPrincipals().add(new EncodedUsernamePasswordPrincipal(username, password.toCharArray()));
    return subject;
}
Also used : DomainPrincipal(org.wildfly.extension.camel.security.DomainPrincipal) EncodedUsernamePasswordPrincipal(org.wildfly.extension.camel.security.EncodedUsernamePasswordPrincipal) Subject(javax.security.auth.Subject)

Example 4 with EncodedUsernamePasswordPrincipal

use of org.wildfly.extension.camel.security.EncodedUsernamePasswordPrincipal in project wildfly-camel by wildfly-extras.

the class AuthorizationPolicyTestCase method getAuthenticationToken.

Subject getAuthenticationToken(String domain, String username, String password) {
    Subject subject = new Subject();
    subject.getPrincipals().add(new DomainPrincipal(domain));
    subject.getPrincipals().add(new EncodedUsernamePasswordPrincipal(username, password.toCharArray()));
    return subject;
}
Also used : DomainPrincipal(org.wildfly.extension.camel.security.DomainPrincipal) EncodedUsernamePasswordPrincipal(org.wildfly.extension.camel.security.EncodedUsernamePasswordPrincipal) Subject(javax.security.auth.Subject)

Example 5 with EncodedUsernamePasswordPrincipal

use of org.wildfly.extension.camel.security.EncodedUsernamePasswordPrincipal in project wildfly-camel by wildfly-extras.

the class SecuredRouteTestCase method getAuthenticationToken.

Subject getAuthenticationToken(String domain, String username, String password) {
    Subject subject = new Subject();
    subject.getPrincipals().add(new DomainPrincipal(domain));
    subject.getPrincipals().add(new EncodedUsernamePasswordPrincipal(username, password.toCharArray()));
    return subject;
}
Also used : DomainPrincipal(org.wildfly.extension.camel.security.DomainPrincipal) EncodedUsernamePasswordPrincipal(org.wildfly.extension.camel.security.EncodedUsernamePasswordPrincipal) Subject(javax.security.auth.Subject)

Aggregations

Subject (javax.security.auth.Subject)5 DomainPrincipal (org.wildfly.extension.camel.security.DomainPrincipal)5 EncodedUsernamePasswordPrincipal (org.wildfly.extension.camel.security.EncodedUsernamePasswordPrincipal)5 RolesAllowed (javax.annotation.security.RolesAllowed)1 ProducerTemplate (org.apache.camel.ProducerTemplate)1