Skip to content

Instantly share code, notes, and snippets.

View darranl's full-sized avatar

Darran Lofthouse darranl

View GitHub Profile
@darranl
darranl / application-security-domain.json
Last active November 27, 2017 14:43
WildFly Elytron Resource Descriptions - LDAP Authentication
[standalone@localhost:9990 /] ./subsystem=undertow/application-security-domain=*:read-resource-description
{
"outcome" => "success",
"result" => [{
"address" => [
("subsystem" => "undertow"),
("application-security-domain" => "*")
],
"outcome" => "success",
"result" => {
/*
* Copyright 2017 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@darranl
darranl / example.java
Created September 14, 2017 14:48
Obtaining Identity and Delegated Credential
import org.wildfly.security.auth.server.IdentityCredentials;
import org.wildfly.security.auth.server.SecurityDomain;
import org.wildfly.security.auth.server.SecurityIdentity;
import org.wildfly.security.credential.PasswordCredential;
import org.wildfly.security.password.interfaces.ClearPassword;
SecurityIdentity securityIdentity = null;
ClearPassword password = null;
// Obtain the SecurityDomain for the currPent deployment, will return null if one not associated.
// Calling code will require the permissions org.wildfly.security.permission.ElytronPermission("getSecurityDomain")
@darranl
darranl / commands.cli
Last active January 30, 2018 08:31
WildFly Elytron - SSL Configuration
Client Cert authentication with fallback to username / password authentication.
# Paths
./path=elytron.project:add(path=/home/darranl/src/wildfly10/wildfly-elytron)
./path=elytron.project.jks:add(path=src/test/resources/ca/jks, relative-to=elytron.project)
./path=elytron.project.properties:add(path=src/test/resources/org/wildfly/security/auth/realm, relative-to=elytron.project)
# KeyStores
&amp#27;[0m&amp#27;[31m12:10:38,054 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC000001: Failed to start service jboss.undertow-test-server: org.jboss.msc.service.StartException in service jboss.undertow-test-server: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1919)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
at io.undertow.Undertow.start(Undertow.java:203)
at org.wildfly.test.undertow.UndertowService.start(UndertowService.java:54)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(Ser227viceControllerImpl.java:1963)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1896)
[standalone@localhost:9990 /] ./subsystem=elytron/properties-realm=*:read-resource-description
{
"outcome" => "success",
"result" => [{
"address" => [
("subsystem" => "elytron"),
("properties-realm" => "*")
],
"outcome" => "success",
"result" => {
{
"outcome" => "success",
"result" => {
"description" => "The Elytron Subsystem",
"attributes" => {},
"operations" => undefined,
"notifications" => undefined,
"children" => {
"configurable-sasl-server-factory" => {
"description" => "A sasl server factory definition where the sasl server factory is an aggregation of other sasl server factories.",
17:59:03,681 INFO (main) [TEST] doBefore <ChannelTestBase.java:85> Running test testRefused
Exception is: java.net.ConnectException: Connection refused
17:59:03,878 INFO (main) [TEST] doAfter <ChannelTestBase.java:92> Finished test testRefused
17:59:03,899 INFO (main) [TEST] doBefore <ChannelTestBase.java:85> Running test testEmptyMessage
Message received
17:59:04,045 INFO (main) [TEST] doAfter <ChannelTestBase.java:92> Finished test testEmptyMessage
17:59:04,058 INFO (main) [TEST] doBefore <ChannelTestBase.java:85> Running test testLotsOfContent
Message received
17:59:04,190 INFO (main) [TEST] doAfter <ChannelTestBase.java:92> Finished test testLotsOfContent
17:59:04,207 INFO (main) [TEST] doBefore <ChannelTestBase.java:85> Running test testWriteCancel
public interface SecurityRealm {
RealmIdentity createRealmIdentity(String name) throws RealmUnavailableException;
CredentialSupport getCredentialSupport(Class<?> credentialType, String algorithmName) throws RealmUnavailableException;
}
@darranl
darranl / commands.txt
Last active August 29, 2015 14:20
Elytron CLI Commands
# KeyStore Commands
./subsystem=elytron/keystore=test:add(type=jks, path=/home/darranl/src/wildfly9/elytron-testing/test.keystore, password=keystore_password)
# Provider Loader Commands
./subsystem=elytron/provider-loader=y:add(register=false, providers=[ {load-services=true, module=org.jboss.sasl}, {load-services=false, module=org.wildfly.security.elytron, class-names=[org.wildfly.security.password.impl.WildFlyElytronPasswordProvider] } ]
If NSS is backed by a SQL database the following environment variable should be exported first: -
export NSS_DEFAULT_DB_TYPE=sql