Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
210 additions
and
1 deletion.
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
4 changes: 3 additions & 1 deletion
4
modules/testsuite/cxf-tests/src/test/etc/jbossws-users.properties
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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
# A sample users.properties file for use with the UsersRolesLoginModule | ||
kermit=thefrog | ||
#Elytron requires this | ||
#$REALM_NAME=JBOSSWS$ This line is used by the add-user utility to identify the realm name already used in this file. | ||
kermit=thefrog |
1 change: 1 addition & 0 deletions
1
...les/testsuite/cxf-tests/src/test/resources/jaxws/cxf/httpauth/WEB-INF/ws-users.properties
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
#$REALM_NAME=ws-basic-domain$ This line is used by the add-user utility to identify the realm name already used in this file. | ||
jbossws=jbossws |
118 changes: 118 additions & 0 deletions
118
modules/testsuite/cxf-tests/src/test/scripts/jbws-testsuite-default-elytron.groovy
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,118 @@ | ||
def root = new XmlParser().parse(project.properties['inputFile']) | ||
|
||
/** | ||
* Fix logging: optionally remove CONSOLE handler and set a specific log file | ||
* | ||
*/ | ||
|
||
def logHandlers = root.profile.subsystem.'root-logger'.handlers[0] | ||
def consoleHandler = logHandlers.find{it.@name == 'CONSOLE'} | ||
if (!project.properties['enableServerLoggingToConsole']) logHandlers.remove(consoleHandler) | ||
def file = root.profile.subsystem.'periodic-rotating-file-handler'.file[0] | ||
file.attributes()['path'] = project.properties['serverLog'] | ||
|
||
/** | ||
* Add a security-domain block like this: | ||
* | ||
* <subsystem xmlns="urn:wildfly:elytron:1.0"> | ||
* <security-domains> | ||
* <security-domain name="JBossWS" default-realm="JBossWS" permission-mapper="login-permission-mapper" role-mapper="combined-role-mapper"> | ||
* <realm name="JBossWS" role-decoder="groups-to-roles"/> | ||
* </security-domain> | ||
* <security-domain name="ws-basic-domain" default-realm="ws-basic-domain" permission-mapper="login-permission-mapper" role-mapper="combined-role-mapper"> | ||
* <realm name="ws-basic-domain" role-decoder="groups-to-roles"/> | ||
* </security-domain> | ||
* </security-domains> | ||
* | ||
* | ||
*/ | ||
|
||
def securityDomains = root.profile.subsystem.'security-domains'[0] | ||
def securityDomain = securityDomains.appendNode('security-domain', ['name':'JBossWS','default-realm':'JBossWS','permission-mapper':'login-permission-mapper','role-mapper':'combined-role-mapper']) | ||
def realm = securityDomain.appendNode('realm',['name':'JBossWS','role-decoder':'groups-to-roles']) | ||
|
||
def basicsecurityDomain = securityDomains.appendNode('security-domain', ['name':'ws-basic-domain','default-realm':'ws-basic-domain','permission-mapper':'login-permission-mapper','role-mapper':'combined-role-mapper']) | ||
def basicrealm = basicsecurityDomain.appendNode('realm',['name':'ws-basic-domain','role-decoder':'groups-to-roles']) | ||
|
||
|
||
/** | ||
* <security-realms> | ||
* <properties-realm name="JBossWS"> | ||
* <users-properties path="/mnt/ssd/jbossws/stack/cxf/trunk/modules/testsuite/cxf-tests/target/test-classes/jbossws-users.properties"/> | ||
* <groups-properties path="application-roles.properties" relative-to="jboss.server.config.dir"/> | ||
* </properties-realm> | ||
* <properties-realm name="ws-basic-domain"> | ||
* <users-properties path="/mnt/ssd/jbossws/stack/cxf/trunk/modules/testsuite/cxf-tests/target/test-classes/ws-users.properties"/> | ||
* <groups-properties path="application-roles.properties"/> | ||
* </properties-realm> | ||
* </security-realms> | ||
* | ||
* | ||
*/ | ||
def securityRealms = root.profile.subsystem.'security-realms'[0] | ||
def propertiesRealm = securityRealms.appendNode('properties-realm', ['name':'JBossWS']) | ||
def usersProperties = propertiesRealm.appendNode('users-properties',['path':project.properties['usersPropFile']]) | ||
def groupsProperties = propertiesRealm.appendNode('groups-properties',['path':project.properties['rolesPropFile']]) | ||
|
||
|
||
def basicPropertiesRealm = securityRealms.appendNode('properties-realm', ['name':'ws-basic-domain']) | ||
def basicUsersProperties = basicPropertiesRealm.appendNode('users-properties',['path': project.properties['testResourcesDir'] + '/jaxws/cxf/httpauth/WEB-INF/ws-users.properties']) | ||
def basicGroupsProperties = basicPropertiesRealm.appendNode('groups-properties',['path': project.properties['testResourcesDir'] + '/jaxws/cxf/httpauth/WEB-INF/ws-roles.properties']) | ||
|
||
|
||
|
||
|
||
/** | ||
* <http> | ||
* <http-authentication-factory name="JBossWS" http-server-mechanism-factory="global" security-domain="JBossWS"> | ||
* <mechanism-configuration> | ||
* <mechanism mechanism-name="BASIC"> | ||
* <mechanism-realm realm-name="JBossWS Realm"/> | ||
* </mechanism> | ||
* </mechanism-configuration> | ||
* </http-authentication-factory> | ||
* <http-authentication-factory name="ws-basic-domain" http-server-mechanism-factory="global" security-domain="ws-basic-domain"> | ||
* <mechanism-configuration> | ||
* <mechanism mechanism-name="BASIC"> | ||
* <mechanism-realm realm-name="ws-basic-domain Realm"/> | ||
* </mechanism> | ||
* </mechanism-configuration> | ||
* </http-authentication-factory> | ||
* | ||
* | ||
*/ | ||
|
||
def httpAuthen = root.profile.subsystem.'http'[0] | ||
def httpAuthenticationFactory = httpAuthen.appendNode('http-authentication-factory', ['name':'JBossWS','http-server-mechanism-factory':'global', 'security-domain':'JBossWS']) | ||
def mechanismConfiguration = httpAuthenticationFactory.appendNode('mechanism-configuration') | ||
def mechanism = mechanismConfiguration.appendNode('mechanism',['mechanism-name':'BASIC']) | ||
def mechanismRealm=mechanism.appendNode('mechanism-realm',['realm-name':'JBossWS Realm']) | ||
|
||
|
||
def basicHttpAuthenticationFactory = httpAuthen.appendNode('http-authentication-factory', ['name':'ws-basic-domain','http-server-mechanism-factory':'global', 'security-domain':'ws-basic-domain']) | ||
def basicMechanismConfiguration = basicHttpAuthenticationFactory.appendNode('mechanism-configuration') | ||
def basicMechanism = basicMechanismConfiguration.appendNode('mechanism',['mechanism-name':'BASIC']) | ||
def basicmechanismRealm = basicMechanism.appendNode('mechanism-realm',['realm-name':'ws-basic-domain Realm']) | ||
|
||
|
||
/** | ||
* <application-security-domains> | ||
* <application-security-domain name="JBossWS" http-authentication-factory="JBossWS"/> | ||
* <application-security-domain name="ws-basic-domain" http-authentication-factory="JBossWS"/> | ||
* </application-security-domains> | ||
*/ | ||
def appSecurityDomains = root.profile.subsystem.'application-security-domains'[1] | ||
def appSecurityDomain = appSecurityDomains.appendNode('application-security-domain', ['name':'JBossWS','http-authentication-factory':'JBossWS']) | ||
|
||
def basicAppSecurityDomain = appSecurityDomains.appendNode('application-security-domain', ['name':'ws-basic-domain','http-authentication-factory':'ws-basic-domain']) | ||
|
||
/** | ||
* Save the configuration to a new file | ||
*/ | ||
|
||
def writer = new StringWriter() | ||
writer.println('<?xml version="1.0" encoding="UTF-8"?>') | ||
new XmlNodePrinter(new PrintWriter(writer)).print(root) | ||
def f = new File(project.properties['outputFile']) | ||
f.write(writer.toString()) |