You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by tb...@apache.org on 2006/12/12 16:24:14 UTC
svn commit: r486187 [47/49] - in /directory/trunks/triplesec: ./ admin-api/
admin-api/src/ admin-api/src/main/ admin-api/src/main/java/
admin-api/src/main/java/org/ admin-api/src/main/java/org/safehaus/
admin-api/src/main/java/org/safehaus/triplesec/ a...
Propchange: directory/trunks/triplesec/webapp-registration/src/main/webapp/images/background.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/trunks/triplesec/webapp-registration/src/main/webapp/images/dark_line.png
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/webapp-registration/src/main/webapp/images/dark_line.png?view=auto&rev=486187
==============================================================================
Binary file - no diff available.
Propchange: directory/trunks/triplesec/webapp-registration/src/main/webapp/images/dark_line.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/trunks/triplesec/webapp-registration/src/main/webapp/images/light_line.png
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/webapp-registration/src/main/webapp/images/light_line.png?view=auto&rev=486187
==============================================================================
Binary file - no diff available.
Propchange: directory/trunks/triplesec/webapp-registration/src/main/webapp/images/light_line.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/trunks/triplesec/webapp-registration/src/main/webapp/images/safehaus-small.gif
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/webapp-registration/src/main/webapp/images/safehaus-small.gif?view=auto&rev=486187
==============================================================================
Binary file - no diff available.
Propchange: directory/trunks/triplesec/webapp-registration/src/main/webapp/images/safehaus-small.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/trunks/triplesec/webapp-registration/src/main/webapp/images/triplesec_logo.gif
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/webapp-registration/src/main/webapp/images/triplesec_logo.gif?view=auto&rev=486187
==============================================================================
Binary file - no diff available.
Propchange: directory/trunks/triplesec/webapp-registration/src/main/webapp/images/triplesec_logo.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/trunks/triplesec/webapp-registration/src/main/webapp/index.html
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/webapp-registration/src/main/webapp/index.html?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/webapp-registration/src/main/webapp/index.html (added)
+++ directory/trunks/triplesec/webapp-registration/src/main/webapp/index.html Tue Dec 12 07:23:31 2006
@@ -0,0 +1,8 @@
+<html>
+ <head>
+ <meta HTTP-EQUIV="REFRESH" content="0; url=registration">
+ </head>
+ <body>
+ <p>If you're not redirected to the <a href="registration">Registration Interface</a></p> then select this link.
+ </body>
+</html>
\ No newline at end of file
Added: directory/trunks/triplesec/webapp-registration/src/test/java/org/safehaus/triplesec/registration/RunRegistrationUI.java
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/webapp-registration/src/test/java/org/safehaus/triplesec/registration/RunRegistrationUI.java?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/webapp-registration/src/test/java/org/safehaus/triplesec/registration/RunRegistrationUI.java (added)
+++ directory/trunks/triplesec/webapp-registration/src/test/java/org/safehaus/triplesec/registration/RunRegistrationUI.java Tue Dec 12 07:23:31 2006
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.safehaus.triplesec.registration;
+
+
+import org.safehaus.triplesec.integration.TriplesecIntegration;
+
+
+public class RunRegistrationUI extends TriplesecIntegration
+{
+ public RunRegistrationUI() throws Exception
+ {
+ super();
+ }
+
+
+ public void testRunForever() throws Exception
+ {
+ System.out.println( "Enter any character to end this test: " );
+ System.in.read();
+ }
+}
Added: directory/trunks/triplesec/webapp-registration/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/webapp-registration/src/test/resources/log4j.properties?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/webapp-registration/src/test/resources/log4j.properties (added)
+++ directory/trunks/triplesec/webapp-registration/src/test/resources/log4j.properties Tue Dec 12 07:23:31 2006
@@ -0,0 +1,11 @@
+# Set root logger level to DEBUG and its only appender to A1.
+log4j.rootLogger=INFO, A1
+
+# A1 is set to be a ConsoleAppender.
+log4j.appender.A1=org.apache.log4j.ConsoleAppender
+
+# A1 uses PatternLayout.
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
+
+
Added: directory/trunks/triplesec/webapp-registration/src/test/resources/server.ldif
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/webapp-registration/src/test/resources/server.ldif?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/webapp-registration/src/test/resources/server.ldif (added)
+++ directory/trunks/triplesec/webapp-registration/src/test/resources/server.ldif Tue Dec 12 07:23:31 2006
@@ -0,0 +1,567 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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 distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#
+#
+# EXAMPLE.COM is freely and reserved for testing according to this RFC:
+#
+# http://www.rfc-editor.org/rfc/rfc2606.txt
+#
+#
+
+#
+# This ACI allows brouse access to the root suffix and one level below that to anyone.
+# At this level there is nothing critical exposed. Everything that matters is one or
+# more levels below this.
+#
+
+dn: cn=browseRootAci,dc=example,dc=com
+objectClass: top
+objectClass: subentry
+objectClass: accessControlSubentry
+subtreeSpecification: { maximum 1 }
+prescriptiveACI: { identificationTag "browseRoot", precedence 100, authenticationLevel none, itemOrUserFirst userFirst: { userClasses { allUsers }, userPermissions { { protectedItems {entry}, grantsAndDenials { grantReturnDN, grantBrowse } } } } }
+
+dn: ou=Users, dc=example, dc=com
+objectclass: top
+objectclass: organizationalunit
+ou: Users
+
+#
+# This ACI allows users to modify a limited set of attributes in their own user
+# entry as well as read, compare those attributes. The user's entry must be
+# browseable and the DN must be returnable.
+#
+
+dn: cn=allowSelfModificationsAci,dc=example,dc=com
+objectClass: top
+objectClass: subentry
+objectClass: accessControlSubentry
+subtreeSpecification: { base "ou=users", maximum 1 }
+prescriptiveACI: { identificationTag "allowSelfModifications", precedence 14, authenticationLevel simple, itemOrUserFirst userFirst: { userClasses { thisEntry }, userPermissions { { protectedItems {entry}, grantsAndDenials { grantReturnDN, grantModify, grantBrowse, grantRead, grantDiscloseOnError } }, { protectedItems {allAttributeValues {userPassword, krb5Key, givenName, cn, commonName, surName, sn, objectClass }}, grantsAndDenials { grantModify, grantAdd, grantRemove, grantRead, grantDiscloseOnError, grantCompare } } } } }
+
+#
+# This ACI allows users to access a limited set of attributes in their own user
+# entry as well as compare those attributes. The user's entry must be browseable
+# and the DN must be returnable.
+#
+
+dn: cn=allowSelfAccessAci,dc=example,dc=com
+objectClass: top
+objectClass: subentry
+objectClass: accessControlSubentry
+subtreeSpecification: { base "ou=users", maximum 1 }
+prescriptiveACI: { identificationTag "allowSelfAccess", precedence 15, authenticationLevel simple, itemOrUserFirst userFirst: { userClasses { thisEntry }, userPermissions { { protectedItems {entry}, grantsAndDenials { grantReturnDN, grantBrowse, grantRead, grantDiscloseOnError } }, { protectedItems {allAttributeValues {uid, userPassword, givenName, cn, commonName, surName, sn, objectClass, creatorsName, modifiersName, createTimestamp, modifyTimestamp, krb5AccountDisabled, description, apacheSamType }}, grantsAndDenials { grantRead, grantDiscloseOnError, grantCompare } } } } }
+
+dn: ou=Groups, dc=example, dc=com
+objectclass: top
+objectclass: organizationalunit
+ou: Groups
+
+dn: cn=superUsers, ou=Groups, dc=example, dc=com
+objectClass: top
+objectClass: groupOfUniqueNames
+cn: superUsers
+uniqueMember: uid=admin, ou=system
+
+dn: cn=userAdmins, ou=Groups, dc=example, dc=com
+objectClass: top
+objectClass: groupOfUniqueNames
+cn: userAdmin
+uniqueMember: uid=admin, ou=system
+
+dn: cn=applicationAdmins, ou=Groups, dc=example, dc=com
+objectClass: top
+objectClass: groupOfUniqueNames
+cn: applicationAdmin
+uniqueMember: uid=admin, ou=system
+
+dn: cn=groupAdmins, ou=Groups, dc=example, dc=com
+objectClass: top
+objectClass: groupOfUniqueNames
+cn: groupAdmin
+uniqueMember: uid=admin, ou=system
+
+#
+# This ACI allows members of the superUsers group to have full modify and read access
+# to the entire realm as does the system administrator principal: uid=admin, ou=system.
+#
+# The only thing these users cannot do is modify the system partition. They are only
+# restricted to superUser rights within this realm partition
+#
+
+dn: cn=superUsersAci,dc=example,dc=com
+objectClass: top
+objectClass: subentry
+objectClass: accessControlSubentry
+subtreeSpecification: { }
+prescriptiveACI: { identificationTag "superUsersAci", precedence 20, authenticationLevel simple, itemOrUserFirst userFirst: { userClasses { userGroup { "cn=superUsers,ou=groups,dc=example,dc=com" } }, userPermissions { { protectedItems {entry, allUserAttributeTypesAndValues}, grantsAndDenials { grantRead, grantReturnDN, grantBrowse, grantDiscloseOnError, grantCompare, grantAdd, grantRename, grantRemove, grantModify, grantImport, grantExport } } } } }
+
+#
+# This ACI allows members of the userAdmin group to have full modify and read access
+# to user accounts besides their own. Hence they can administer users in the system.
+#
+
+dn: cn=userAdminsAci,dc=example,dc=com
+objectClass: top
+objectClass: subentry
+objectClass: accessControlSubentry
+subtreeSpecification: { base "ou=users", maximum 1 }
+prescriptiveACI: { identificationTag "userAdminsAci", precedence 16, authenticationLevel simple, itemOrUserFirst userFirst: { userClasses { userGroup { "cn=userAdmins,ou=groups,dc=example,dc=com" } }, userPermissions { { protectedItems {entry, allUserAttributeTypesAndValues}, grantsAndDenials { grantRead, grantReturnDN, grantBrowse, grantDiscloseOnError, grantCompare, grantAdd, grantRename, grantRemove, grantModify, grantImport, grantExport } } } } }
+
+
+#
+# This ACI allows members of the applicationAdmin group to have full modify and read access
+# to all applications in the realm. Adding users to this group is like a wild card for
+# application access.
+#
+
+dn: cn=applicationAdminsAci,dc=example,dc=com
+objectClass: top
+objectClass: subentry
+objectClass: accessControlSubentry
+subtreeSpecification: { base "ou=applications" }
+prescriptiveACI: { identificationTag "applicationAdminsAci", precedence 17, authenticationLevel simple, itemOrUserFirst userFirst: { userClasses { userGroup { "cn=applicationAdmins,ou=groups,dc=example,dc=com" } }, userPermissions { { protectedItems {entry, allUserAttributeTypesAndValues}, grantsAndDenials { grantRead, grantReturnDN, grantBrowse, grantDiscloseOnError, grantCompare, grantAdd, grantRename, grantRemove, grantModify, grantImport, grantExport } } } } }
+
+
+#
+# This ACI allows members of the groupAdmins group to have full modify and read access
+# to all groups in the realm other than the superUsers, userAdmins, groupAdmins, and the
+# applicationAdmins groups.
+#
+# The rational behind this is to prevent these users from changing their or other
+# users' access rights for the entire system by modifying their membership in these
+# groups. Making someone a groupAdmin should not open the door to their ability to
+# grant themselves or others system wide administrative abilities.
+#
+# Really the groupAdmins group is intended for users that have the ability to manage
+# group membership in specific application administration groups and that's all.
+# These types of admins should not have the right to promote others to system level
+# administrators or complete super users.
+#
+
+dn: cn=groupAdminsAci,dc=example,dc=com
+objectClass: top
+objectClass: subentry
+objectClass: accessControlSubentry
+subtreeSpecification: { base "ou=groups", specificExclusions { chopBefore: "cn=userAdmins", chopBefore: "cn=groupAdmins", chopBefore: "cn=applicationAdmins", chopBefore: "cn=superUsers" } }
+prescriptiveACI: { identificationTag "groupAdminsAci", precedence 18, authenticationLevel simple, itemOrUserFirst userFirst: { userClasses { userGroup { "cn=groupAdmins,ou=groups,dc=example,dc=com" } }, userPermissions { { protectedItems {entry, allUserAttributeTypesAndValues}, grantsAndDenials { grantRead, grantReturnDN, grantBrowse, grantDiscloseOnError, grantCompare, grantAdd, grantRename, grantRemove, grantModify, grantImport, grantExport } } } } }
+
+# ----------------------------------------------------------------------------
+# Required Kerberos Server User
+# ----------------------------------------------------------------------------
+
+dn: uid=krbtgt, ou=Users, dc=example,dc=com
+cn: Kerberos Server
+sn: Server
+givenName: Kerberos
+objectClass: top
+objectClass: uidObject
+objectClass: person
+objectClass: organizationalPerson
+objectClass: inetOrgPerson
+objectClass: krb5Principal
+objectClass: krb5KDCEntry
+ou: Users
+uid: krbtgt
+krb5PrincipalName: krbtgt/EXAMPLE.COM@EXAMPLE.COM
+krb5KeyVersionNumber: 0
+mail: admin@example.com
+userPassword: secret
+
+# ----------------------------------------------------------------------------
+# Sample Hauskeys Users
+# ----------------------------------------------------------------------------
+
+dn: uid=mplanck, ou=Users, dc=example,dc=com
+cn: Max Planck
+sn: Planck
+givenName: Max
+objectClass: top
+objectClass: uidObject
+objectClass: person
+objectClass: organizationalPerson
+objectClass: extensibleObject
+objectClass: inetOrgPerson
+objectClass: krb5Principal
+objectClass: krb5KDCEntry
+objectClass: safehausProfile
+ou: Users
+uid: mplanck
+krb5PrincipalName: mplanck@EXAMPLE.COM
+krb5KeyVersionNumber: 0
+mail: mplanck@example.com
+telephoneNumber: +1 904 982 6882
+facsimileTelephoneNumber: +1 904 982 6883
+roomNumber: 666
+apacheSamType: 7
+safehausUid: mplanck
+safehausRealm: EXAMPLE.COM
+safehausLabel: example realm
+safehausFactor: 27304238
+safehausSecret:: aaaabbbbccccdddd
+safehausFailuresInEpoch: 0
+safehausResynchCount: -1
+safehausTokenPin: 1234
+safehausInfo: test account
+safehausNotifyBy: sms
+userPassword: secret
+
+dn: uid=aeinstein, ou=Users, dc=example,dc=com
+cn: Albert Einstein
+sn: Einstein
+givenName: Albert
+objectClass: top
+objectClass: uidObject
+objectClass: person
+objectClass: organizationalPerson
+objectClass: extensibleObject
+objectClass: inetOrgPerson
+objectClass: krb5Principal
+objectClass: krb5KDCEntry
+objectClass: safehausProfile
+ou: Users
+uid: aeinstein
+krb5PrincipalName: aeinstein@EXAMPLE.COM
+krb5KeyVersionNumber: 0
+mail: aeinstein@example.com
+telephoneNumber: +1 904 982 6882
+facsimileTelephoneNumber: +1 904 982 6883
+roomNumber: 666
+apacheSamType: 7
+safehausUid: aeinstein
+safehausRealm: EXAMPLE.COM
+safehausLabel: example realm
+safehausFactor: 8745127341
+safehausSecret:: eeeeffffgggghhhh
+safehausFailuresInEpoch: 0
+safehausResynchCount: -1
+safehausTokenPin: 1234
+safehausInfo: test account
+safehausNotifyBy: sms
+userPassword: secret
+
+dn: uid=nbohr, ou=Users, dc=example,dc=com
+cn: Neils Bohr
+sn: Bohr
+givenName: Neils
+objectClass: top
+objectClass: uidObject
+objectClass: person
+objectClass: organizationalPerson
+objectClass: extensibleObject
+objectClass: inetOrgPerson
+objectClass: krb5Principal
+objectClass: krb5KDCEntry
+objectClass: safehausProfile
+ou: Users
+uid: nbohr
+krb5PrincipalName: nbohr@EXAMPLE.COM
+krb5KeyVersionNumber: 0
+mail: nbohr@example.com
+telephoneNumber: +1 904 982 6882
+facsimileTelephoneNumber: +1 904 982 6883
+roomNumber: 666
+apacheSamType: 7
+safehausUid: nbohr
+safehausRealm: EXAMPLE.COM
+safehausLabel: example realm
+safehausFactor: 8745127341
+safehausSecret:: iiiijjjjkkkkllll
+safehausFailuresInEpoch: 0
+safehausResynchCount: -1
+safehausTokenPin: 1234
+safehausInfo: test account
+safehausNotifyBy: sms
+userPassword: secret
+
+# ----------------------------------------------------------------------------
+# Sample Local Users (not 2-factor)
+# ----------------------------------------------------------------------------
+
+dn: uid=mborn, ou=Users, dc=example,dc=com
+cn: Max Born
+sn: Born
+givenName: Max
+objectClass: top
+objectClass: uidObject
+objectClass: person
+objectClass: organizationalPerson
+objectClass: inetOrgPerson
+objectClass: krb5Principal
+objectClass: krb5KDCEntry
+objectClass: safehausProfile
+ou: Users
+uid: mborn
+krb5PrincipalName: mborn@EXAMPLE.COM
+krb5KeyVersionNumber: 0
+mail: mborn@example.com
+telephoneNumber: +1 904 982 6882
+facsimileTelephoneNumber: +1 904 982 6883
+roomNumber: 667
+safehausUid: mborn
+safehausRealm: EXAMPLE.COM
+safehausLabel: example realm
+safehausFactor: 917483720127847
+safehausSecret:: xcJqp45S80e8fahs&@rq1I98awg8)^*
+safehausFailuresInEpoch: 0
+safehausTokenPin: 1234
+safehausResynchCount: -1
+safehausInfo: test account
+safehausNotifyBy: sms
+userPassword: secret
+
+dn: uid=wpauli, ou=Users, dc=example,dc=com
+cn: Wolfgang Pauli
+sn: Pauli
+givenName: Wolfgang
+objectClass: top
+objectClass: uidObject
+objectClass: person
+objectClass: organizationalPerson
+objectClass: inetOrgPerson
+objectClass: krb5Principal
+objectClass: krb5KDCEntry
+objectClass: safehausProfile
+ou: Users
+uid: wpauli
+krb5PrincipalName: wpauli@EXAMPLE.COM
+krb5KeyVersionNumber: 0
+mail: wpauli@example.com
+telephoneNumber: +1 904 982 6882
+facsimileTelephoneNumber: +1 904 982 6883
+roomNumber: 667
+safehausUid: wpauli
+safehausRealm: EXAMPLE.COM
+safehausLabel: example realm
+safehausFactor: 917483720127847
+safehausSecret:: xcJqp45S80e8fahs&@rq1I98awg8)^*
+safehausFailuresInEpoch: 0
+safehausTokenPin: 1234
+safehausResynchCount: -1
+safehausInfo: test account
+safehausNotifyBy: sms
+userPassword: secret
+
+dn: uid=mcurie, ou=Users, dc=example,dc=com
+cn: Marie Curie
+sn: Curie
+givenName: Marie
+objectClass: top
+objectClass: uidObject
+objectClass: person
+objectClass: organizationalPerson
+objectClass: inetOrgPerson
+objectClass: krb5Principal
+objectClass: krb5KDCEntry
+objectClass: safehausProfile
+ou: Users
+uid: mcurie
+krb5PrincipalName: mcurie@EXAMPLE.COM
+krb5KeyVersionNumber: 0
+mail: mcurie@example.com
+telephoneNumber: +1 904 982 6882
+facsimileTelephoneNumber: +1 904 982 6883
+roomNumber: 667
+safehausUid: mcurie
+safehausRealm: EXAMPLE.COM
+safehausLabel: example realm
+safehausFactor: 917483720127847
+safehausSecret:: xcJqp45S80e8fahs&@rq1I98awg8)^*
+safehausFailuresInEpoch: 0
+safehausTokenPin: 1234
+safehausResynchCount: -1
+safehausInfo: test account
+safehausNotifyBy: sms
+userPassword: secret
+
+# ----------------------------------------------------------------------------
+# Sample External Users (not 2-factor)
+# ----------------------------------------------------------------------------
+
+dn: uid=pdirac, ou=Users, dc=example,dc=com
+objectClass: top
+objectClass: uidObject
+objectClass: extensibleObject
+objectClass: referral
+uid: pdirac
+ref: ldap://ad.example.com/uid=pdirac, ou=Users, dc=example,dc=com
+
+dn: uid=efermi, ou=Users, dc=example,dc=com
+objectClass: top
+objectClass: uidObject
+objectClass: extensibleObject
+objectClass: referral
+uid: efermi
+ref: ldap://openldap.example.com/uid=efermi, ou=Users, dc=example,dc=com
+
+dn: uid=rfeynman, ou=Users, dc=example,dc=com
+objectClass: top
+objectClass: uidObject
+objectClass: extensibleObject
+objectClass: referral
+uid: rfeynman
+ref: ldap://apacheds.example.com/uid=rfeynman, ou=Users, dc=example,dc=com
+
+# ----------------------------------------------------------------------------
+# Applications
+# ----------------------------------------------------------------------------
+
+dn: ou=Applications,dc=example,dc=com
+objectClass: top
+objectClass: organizationalunit
+ou: applications
+
+dn: appname=demo,ou=Applications,dc=example,dc=com
+objectclass: policyApplication
+objectclass: top
+appname: demo
+description: Demo application.
+userpassword:: c2VjcmV0
+
+dn: ou=permissions,appname=demo,ou=Applications,dc=example,dc=com
+objectclass: organizationalUnit
+objectclass: top
+ou: permissions
+
+dn: permname=bend,ou=permissions,appname=demo,ou=Applications,dc=example,dc=com
+objectclass: policyPermission
+objectclass: top
+permname: bend
+
+dn: permname=fold,ou=permissions,appname=demo,ou=Applications,dc=example,dc=com
+objectclass: policyPermission
+objectclass: top
+permname: fold
+
+dn: permname=mutilate,ou=permissions,appname=demo,ou=Applications,dc=example,dc=com
+objectclass: policyPermission
+objectclass: top
+permname: mutilate
+
+dn: permname=spindle,ou=permissions,appname=demo,ou=Applications,dc=example,dc=com
+objectclass: policyPermission
+objectclass: top
+permname: spindle
+
+dn: permname=twist,ou=permissions,appname=demo,ou=Applications,dc=example,dc=com
+objectclass: policyPermission
+objectclass: top
+permname: twist
+
+dn: ou=roles,appname=demo,ou=Applications,dc=example,dc=com
+objectclass: organizationalUnit
+objectclass: top
+ou: roles
+
+dn: rolename=superuser,ou=roles,appname=demo,ou=Applications,dc=example,dc=com
+objectclass: policyRole
+objectclass: top
+grants: bend
+grants: fold
+grants: mutilate
+grants: spindle
+grants: twist
+rolename: superuser
+
+dn: rolename=untrusted,ou=roles,appname=demo,ou=Applications,dc=example,dc=com
+objectclass: policyRole
+objectclass: top
+grants: bend
+rolename: untrusted
+
+dn: rolename=trusted,ou=roles,appname=demo,ou=Applications,dc=example,dc=com
+objectclass: policyRole
+objectclass: top
+grants: bend
+grants: fold
+grants: mutilate
+rolename: trusted
+
+dn: ou=profiles,appname=demo,ou=Applications,dc=example,dc=com
+objectclass: organizationalUnit
+objectclass: top
+ou: profiles
+
+dn: profileid=nbohr,ou=profiles,appname=demo,ou=Applications,dc=example,dc=com
+objectclass: policyProfile
+objectclass: top
+profileid: nbohr
+roles: trusted
+user: nbohr
+
+dn: profileid=nbohr-superuser,ou=profiles,appname=demo,ou=Applications,dc=example,dc=com
+objectclass: policyProfile
+objectclass: top
+denials: fold
+profileid: nbohr-superuser
+roles: superuser
+user: nbohr
+
+dn: profileid=mborn,ou=profiles,appname=demo,ou=Applications,dc=example,dc=com
+objectclass: policyProfile
+objectclass: top
+grants: twist
+profileid: mborn
+roles: trusted
+user: mborn
+
+dn: profileid=aeinstein,ou=profiles,appname=demo,ou=Applications,dc=example,dc=com
+objectclass: policyProfile
+objectclass: top
+grants: twist
+profileid: aeinstein
+roles: trusted
+user: aeinstein
+
+dn: profileid=mcurie,ou=profiles,appname=demo,ou=Applications,dc=example,dc=com
+objectclass: policyProfile
+objectclass: top
+grants: spindle
+profileid: mcurie
+roles: trusted
+user: mcurie
+
+dn: profileid=wpauli,ou=profiles,appname=demo,ou=Applications,dc=example,dc=com
+objectclass: policyProfile
+objectclass: top
+profileid: wpauli
+roles: untrusted
+user: wpauli
+
+dn: appName=tsecAdminTool,ou=Applications,dc=example,dc=com
+objectClass: policyApplication
+objectClass: top
+appName: safehausAdminUI
+description: Policy for Safehaus web and swing based administration UIs.
+userPassword: secret
+
+dn: ou=Permissions,appName=tsecAdminTool,ou=Applications,dc=example,dc=com
+objectClass: organizationalUnit
+objectClass: top
+ou: Permissions
+
+dn: ou=Roles,appName=tsecAdminTool,ou=Applications,dc=example,dc=com
+objectClass: organizationalUnit
+objectClass: top
+ou: Roles
+
+dn: ou=Profiles,appName=tsecAdminTool,ou=Applications,dc=example,dc=com
+objectClass: organizationalUnit
+objectClass: top
+ou: Profiles
Added: directory/trunks/triplesec/webapp-registration/src/test/resources/server.xml
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/webapp-registration/src/test/resources/server.xml?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/webapp-registration/src/test/resources/server.xml (added)
+++ directory/trunks/triplesec/webapp-registration/src/test/resources/server.xml Tue Dec 12 07:23:31 2006
@@ -0,0 +1,250 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
+ "http://www.springframework.org/dtd/spring-beans.dtd">
+
+<beans>
+ <bean id="environment" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
+ <property name="properties">
+ <props>
+ <prop key="java.naming.security.authentication">simple</prop>
+ <prop key="java.naming.security.principal">uid=admin,ou=system</prop>
+ <prop key="java.naming.security.credentials">secret</prop>
+ <prop key="java.naming.provider.url">dc=example,dc=com</prop>
+ <prop key="java.naming.factory.state">org.safehaus.triplesec.store.ProfileStateFactory</prop>
+ <prop key="java.naming.factory.object">org.safehaus.triplesec.store.ProfileObjectFactory</prop>
+
+ <prop key="kdc.primary.realm">EXAMPLE.COM</prop>
+ <prop key="kdc.principal">krbtgt/EXAMPLE.COM@EXAMPLE.COM</prop>
+ <prop key="kdc.encryption.types">des-cbc-md5 des3-cbc-sha1 des3-cbc-md5 des-cbc-md4 des-cbc-crc</prop>
+ <prop key="kdc.entryBaseDn">ou=users,dc=example,dc=com</prop>
+ <prop key="kdc.java.naming.security.credentials">secret</prop>
+
+ <prop key="changepw.entryBaseDn">ou=users,dc=example,dc=com</prop>
+ <prop key="changepw.java.naming.security.credentials">secret</prop>
+ <prop key="changepw.principal">kadmin/changepw@EXAMPLE.COM</prop>
+
+ <!-- All times are in minutes -->
+ <prop key="kdc.allowable.clockskew">5</prop>
+ <prop key="kdc.tgs.maximum.ticket.lifetime">1440</prop>
+ <prop key="kdc.tgs.maximum.renewable.lifetime">10080</prop>
+ <prop key="kdc.pa.enc.timestamp.required">true</prop>
+ <prop key="kdc.tgs.empty.addresses.allowed">true</prop>
+ <prop key="kdc.tgs.forwardable.allowed">true</prop>
+ <prop key="kdc.tgs.proxiable.allowed">true</prop>
+ <prop key="kdc.tgs.postdate.allowed">true</prop>
+ <prop key="kdc.tgs.renewable.allowed">true</prop>
+
+ <prop key="safehaus.entry.basedn">ou=Users,dc=example,dc=com</prop>
+ <prop key="safehaus.load.testdata">true</prop>
+ <prop key="kerberos.sam.type.7">org.safehaus.triplesec.verifier.hotp.DefaultHotpSamVerifier</prop>
+ </props>
+ </property>
+ </bean>
+
+ <bean id="configuration" class="org.safehaus.triplesec.configuration.MutableTriplesecStartupConfiguration">
+ <property name="workingDirectory"><value>partitions</value></property>
+ <property name="allowAnonymousAccess"><value>false</value></property>
+ <property name="accessControlEnabled"><value>true</value></property>
+ <property name="ldapPort"><value>10389</value></property>
+ <property name="enableKerberos"><value>true</value></property>
+ <property name="enableNtp"><value>false</value></property>
+ <property name="enableChangePassword"><value>true</value></property>
+
+ <!-- Uncomment below to have the server load entries on startup! -->
+ <!-- ldifDirectory property can point to a relative file, directory or -->
+ <!-- can point to an absolute path to either using the URL path -->
+ <!-- notation: i.e. file:///Users/jack/apacheds/ldifs -->
+
+ <!-- Entries will optionally be filtered using LdifLoadFilters in the -->
+ <!-- order specified. The included Krb5KdcEntryFilter will filter -->
+ <!-- kerberos principals creating keys for them using their -->
+ <!-- userPassword attribute if present. -->
+
+ <!-- If missing the Triplesec server will use LDIF files under the conf -->
+ <!-- directory where it has been installed. -->
+
+ <!--
+ <property name="ldifDirectory">
+ <value>example.ldif</value>
+ </property>
+ -->
+ <property name="ldifFilters">
+ <list>
+ <bean class="org.apache.directory.server.protocol.shared.store.Krb5KdcEntryFilter"/>
+ </list>
+ </property>
+
+ <property name="activationConfiguration">
+ <bean class="org.safehaus.triplesec.configuration.ActivationConfiguration">
+ <property name="enableDecoyMidlet"><value>true</value></property>
+ <property name="otpLength"><value>6</value></property>
+ <property name="midletNameAttribute"><value>midletNameAttribute</value></property>
+ </bean>
+ </property>
+
+ <property name="smsConfiguration">
+ <bean class="org.safehaus.triplesec.configuration.SmsConfiguration">
+ <property name="smsUsername"><value>hauskeys</value></property>
+ <property name="smsPassword"><value>secret</value></property>
+ <property name="smsAccountName"><value>demo</value></property>
+ <property name="smsTransportUrl"><value>http://www.nbroadcasting.com/customers/messages/Sender.asp</value></property>
+ </bean>
+ </property>
+
+ <property name="smtpConfiguration">
+ <bean class="org.safehaus.triplesec.configuration.SmtpConfiguration">
+ <property name="smtpAuthenticate"><value>false</value></property>
+ <!-- uncomment and set above property if authentication is required by mail server
+ <property name="smtpUsername"><value>hauskeys</value></property>
+ <property name="smtpPassword"><value>secret</value></property>
+ -->
+ <property name="smtpHost"><value>localhost</value></property>
+ <property name="smtpSubject"><value>Triplesec Account Activated</value></property>
+ <property name="smtpFrom"><value>dev@safehaus.org</value></property>
+ </bean>
+ </property>
+
+ <property name="contextPartitionConfigurations">
+ <set>
+ <ref bean="examplePartitionConfiguration"/>
+ </set>
+ </property>
+ <property name="bootstrapSchemas">
+ <set>
+ <bean class="org.apache.directory.server.core.schema.bootstrap.CorbaSchema"/>
+ <bean class="org.apache.directory.server.core.schema.bootstrap.CoreSchema"/>
+ <bean class="org.apache.directory.server.core.schema.bootstrap.CosineSchema"/>
+ <bean class="org.apache.directory.server.core.schema.bootstrap.ApacheSchema"/>
+ <bean class="org.apache.directory.server.core.schema.bootstrap.CollectiveSchema"/>
+ <bean class="org.apache.directory.server.core.schema.bootstrap.InetorgpersonSchema"/>
+ <bean class="org.apache.directory.server.core.schema.bootstrap.JavaSchema"/>
+ <bean class="org.apache.directory.server.core.schema.bootstrap.Krb5kdcSchema"/>
+ <bean class="org.apache.directory.server.core.schema.bootstrap.SystemSchema"/>
+ <bean class="org.safehaus.triplesec.store.schema.SafehausSchema"/>
+ </set>
+ </property>
+
+ <property name="extendedOperationHandlers">
+ <list>
+ <bean class="org.apache.directory.server.ldap.support.extended.GracefulShutdownHandler"/>
+ <bean class="org.apache.directory.server.ldap.support.extended.LaunchDiagnosticUiHandler"/>
+ </list>
+ </property>
+
+ <property name="interceptorConfigurations">
+ <list>
+ <bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
+ <property name="name"><value>normalizationService</value></property>
+ <property name="interceptor">
+ <bean class="org.apache.directory.server.core.normalization.NormalizationService" />
+ </property>
+ </bean>
+ <bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
+ <property name="name"><value>authenticationService</value></property>
+ <property name="interceptor">
+ <bean class="org.apache.directory.server.core.authn.AuthenticationService" />
+ </property>
+ </bean>
+ <bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
+ <property name="name"><value>referralService</value></property>
+ <property name="interceptor">
+ <bean class="org.apache.directory.server.core.referral.ReferralService" />
+ </property>
+ </bean>
+ <bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
+ <property name="name"><value>authorizationService</value></property>
+ <property name="interceptor">
+ <bean class="org.apache.directory.server.core.authz.AuthorizationService" />
+ </property>
+ </bean>
+ <bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
+ <property name="name"><value>defaultAuthorizationService</value></property>
+ <property name="interceptor">
+ <bean class="org.apache.directory.server.core.authz.DefaultAuthorizationService" />
+ </property>
+ </bean>
+ <bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
+ <property name="name"><value>exceptionService</value></property>
+ <property name="interceptor">
+ <bean class="org.apache.directory.server.core.exception.ExceptionService" />
+ </property>
+ </bean>
+ <bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
+ <property name="name"><value>schemaService</value></property>
+ <property name="interceptor">
+ <bean class="org.apache.directory.server.core.schema.SchemaService" />
+ </property>
+ </bean>
+ <bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
+ <property name="name"><value>subentryService</value></property>
+ <property name="interceptor">
+ <bean class="org.apache.directory.server.core.subtree.SubentryService" />
+ </property>
+ </bean>
+ <bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
+ <property name="name"><value>operationalAttributeService</value></property>
+ <property name="interceptor">
+ <bean class="org.apache.directory.server.core.operational.OperationalAttributeService" />
+ </property>
+ </bean>
+ <bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
+ <property name="name"><value>collectiveAttributeService</value></property>
+ <property name="interceptor">
+ <bean class="org.apache.directory.server.core.collective.CollectiveAttributeService" />
+ </property>
+ </bean>
+ <bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
+ <property name="name"><value>eventService</value></property>
+ <property name="interceptor">
+ <bean class="org.apache.directory.server.core.event.EventService" />
+ </property>
+ </bean>
+ <bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
+ <property name="name"><value>policyProtectionService</value></property>
+ <property name="interceptor">
+ <bean class="org.safehaus.triplesec.store.interceptor.PolicyProtectionInterceptor" />
+ </property>
+ </bean>
+ </list>
+ </property>
+ </bean>
+
+ <bean id="examplePartitionConfiguration" class="org.apache.directory.server.core.configuration.MutablePartitionConfiguration">
+ <property name="name"><value>example</value></property>
+ <property name="suffix"><value>dc=example,dc=com</value></property>
+ <property name="indexedAttributes">
+ <set>
+ <value>objectClass</value>
+ <value>ou</value>
+ <value>dc</value>
+ <value>uid</value>
+ <value>profileId</value>
+ <value>roles</value>
+ <value>grants</value>
+ <value>denials</value>
+ <value>krb5PrincipalName</value>
+ </set>
+ </property>
+ <property name="contextEntry">
+ <value>
+ objectClass: top
+ objectClass: domain
+ objectClass: extensibleObject
+ dc: example
+ administrativeRole: accessControlSpecificArea
+ administrativeRole: collectiveAttributeSpecificArea
+ </value>
+ </property>
+ </bean>
+
+ <bean class="org.springframework.beans.factory.config.CustomEditorConfigurer">
+ <property name="customEditors">
+ <map>
+ <entry key="javax.naming.directory.Attributes">
+ <bean class="org.apache.directory.server.core.configuration.AttributesPropertyEditor"/>
+ </entry>
+ </map>
+ </property>
+ </bean>
+</beans>
Added: directory/trunks/triplesec/webapp-root/deploy.sh
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/webapp-root/deploy.sh?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/webapp-root/deploy.sh (added)
+++ directory/trunks/triplesec/webapp-root/deploy.sh Tue Dec 12 07:23:31 2006
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+maven -o war:inplace
+cp -rf src/webapp/* .deployables/triplesec-webapp/
+
Propchange: directory/trunks/triplesec/webapp-root/deploy.sh
------------------------------------------------------------------------------
svn:executable =
Added: directory/trunks/triplesec/webapp-root/pom.xml
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/webapp-root/pom.xml?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/webapp-root/pom.xml (added)
+++ directory/trunks/triplesec/webapp-root/pom.xml Tue Dec 12 07:23:31 2006
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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 distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.safehaus.triplesec</groupId>
+ <artifactId>build</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>triplesec-webapp-root</artifactId>
+ <name>Triplesec Webapp for Root</name>
+ <packaging>war</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>tomcat</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>5.5.12</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <finalName>triplesec-webapp-root</finalName>
+ </build>
+</project>
Added: directory/trunks/triplesec/webapp-root/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/webapp-root/src/main/webapp/WEB-INF/web.xml?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/webapp-root/src/main/webapp/WEB-INF/web.xml (added)
+++ directory/trunks/triplesec/webapp-root/src/main/webapp/WEB-INF/web.xml Tue Dec 12 07:23:31 2006
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+ <display-name>webroot</display-name>
+ <welcome-file-list>
+ <welcome-file>index.html</welcome-file>
+ <welcome-file>index.htm</welcome-file>
+ <welcome-file>index.jsp</welcome-file>
+ <welcome-file>default.html</welcome-file>
+ <welcome-file>default.htm</welcome-file>
+ <welcome-file>default.jsp</welcome-file>
+ </welcome-file-list>
+ </web-app>
Added: directory/trunks/triplesec/webapp-root/src/main/webapp/index.html
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/webapp-root/src/main/webapp/index.html?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/webapp-root/src/main/webapp/index.html (added)
+++ directory/trunks/triplesec/webapp-root/src/main/webapp/index.html Tue Dec 12 07:23:31 2006
@@ -0,0 +1,25 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<title>Triplesec Server</title>
+</head>
+
+<body>
+<h1>Triplesec Console</h1>
+
+<!--
+This really needs to be a JSP. We have to ask the server which apps are installed and
+decide what links to show here. Might be a good idea to have each web application
+register itself with the LDAP server under ou=configuration for this kind of coordination
+between the web applications. I guess if the http service is activated this minimal
+webapplication for the webroot should be available.
+-->
+
+<ul>
+ <li><a href="/registration/">Account Registration</a></li>
+ <li><a href="/demo/">401k Management Demo</a></li>
+</ul>
+</body>
+
+</html>
Propchange: directory/trunks/triplesec/webapp-root/src/main/webapp/index.html
------------------------------------------------------------------------------
svn:executable =
Added: directory/trunks/triplesec/webapp-servlet-demo/pom.xml
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/webapp-servlet-demo/pom.xml?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/webapp-servlet-demo/pom.xml (added)
+++ directory/trunks/triplesec/webapp-servlet-demo/pom.xml Tue Dec 12 07:23:31 2006
@@ -0,0 +1,162 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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 distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.safehaus.triplesec</groupId>
+ <artifactId>build</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>triplesec-webapp-servlet-demo</artifactId>
+ <name>Triplesec Webapp Servlet Demo</name>
+ <packaging>war</packaging>
+ <repositories>
+ <!-- For apacheds snapshots -->
+ <repository>
+ <id>apachecvs</id>
+ <name>Apache Snapshot Repository</name>
+ <url>http://cvs.apache.org/maven-snapshot-repository</url>
+ </repository>
+
+ <repository>
+ <id>safehaus</id>
+ <name>Alternate Repository for Safehaus Artifacts</name>
+ <url>http://m2.safehaus.org</url>
+ </repository>
+ </repositories>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>triplesec-jaas</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>triplesec-guardian-ldap</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>nlog4j</artifactId>
+ <version>1.2.25</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>triplesec-integration</artifactId>
+ <version>${pom.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>tomcat</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>5.5.12</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <finalName>triplesec-servlet-demo</finalName>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <!-- Do not run this test since it never exists -->
+ <exclude>**/RunDemoUI.java</exclude>
+ <!-- Avoid normal integration tests -->
+ <exclude>**/*ITest.java</exclude>
+ <exclude>**/*IntegrationTest.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>integration</id>
+ <activation>
+ <property><name>integration</name></property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemProperties>
+ <property>
+ <name>org.safehaus.triplesec.integration.resourcesDirectory</name>
+ <value>${basedir}/src/test/resources</value>
+ </property>
+ </systemProperties>
+ <excludes>
+ <!-- Do not run this test since it never exists -->
+ <exclude>**/RunDemoUI.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>ui</id>
+ <activation>
+ <property><name>ui</name></property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemProperties>
+ <property>
+ <name>org.safehaus.triplesec.integration.resourcesDirectory</name>
+ <value>${basedir}/src/test/resources</value>
+ </property>
+ <property>
+ <name>org.safehaus.triplesec.integration.webapps</name>
+ <value>demo</value>
+ </property>
+ <property>
+ <name>org.safehaus.triplesec.integration.webappWarBase.demo</name>
+ <value>${basedir}/target/triplesec-servlet-demo.war</value>
+ </property>
+ </systemProperties>
+ <includes>
+ <include>**/RunDemoUI.java</include>
+ </includes>
+ <excludes>
+ <exclude>**/*Test.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
Added: directory/trunks/triplesec/webapp-servlet-demo/src/main/java/org/safehaus/triplesec/demo/LoginCommand.java
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/webapp-servlet-demo/src/main/java/org/safehaus/triplesec/demo/LoginCommand.java?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/webapp-servlet-demo/src/main/java/org/safehaus/triplesec/demo/LoginCommand.java (added)
+++ directory/trunks/triplesec/webapp-servlet-demo/src/main/java/org/safehaus/triplesec/demo/LoginCommand.java Tue Dec 12 07:23:31 2006
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.safehaus.triplesec.demo;
+
+
+import javax.security.auth.spi.LoginModule;
+import javax.security.auth.callback.*;
+import javax.security.auth.Subject;
+import javax.security.auth.login.LoginException;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.safehaus.triplesec.guardian.ApplicationPolicy;
+import org.safehaus.triplesec.jaas.PasscodeCallback;
+import org.safehaus.triplesec.jaas.PolicyCallback;
+import org.safehaus.triplesec.jaas.RealmCallback;
+import org.safehaus.triplesec.jaas.SafehausLoginModule;
+import org.safehaus.triplesec.jaas.SafehausPrincipal;
+
+
+/**
+ * Simple login command used by the demo application.
+ *
+ * @author <a href="mailto:akarasulu@safehaus.org">Alex Karasulu</a>
+ * @version $Rev$
+ */
+public class LoginCommand
+{
+ /** the user id of the principal minus realm info */
+ private final String userId;
+ /** the realm the user is authenticating into */
+ private final String realm;
+ /** the value of the hotp */
+ private final String passcode;
+ /** the static password for the user */
+ private final String password;
+ /** the triplesec guardian policy for this application */
+ private final ApplicationPolicy policy;
+
+ /** the safehaus principal resulting from authentication */
+ private SafehausPrincipal principal;
+
+
+ /**
+ * Creates a single use login command that can later be executed.
+ *
+ * @param userId the user id of the principal minus realm info
+ * @param realm the realm the user is authenticating into
+ * @param passcode the value of the hotp
+ */
+ public LoginCommand( String userId, String password, String realm, String passcode, ApplicationPolicy policy )
+ {
+ this.userId = userId;
+ this.realm = realm;
+ this.passcode = passcode;
+ this.password = password;
+ this.policy = policy;
+ }
+
+
+ /**
+ * Logs the user into the system. Exceptions will contain optional information used to determine
+ * if a resync is in effect or if the account is locked out.
+ *
+ * @return true if we can authenticate the user, false otherwise
+ */
+ public boolean execute() throws LoginException
+ {
+ LoginModule module = new SafehausLoginModule();
+ Subject subject = new Subject();
+ Map options = new HashMap();
+ options.put( SafehausLoginModule.ALLOW_ADMIN, "true" );
+ module.initialize( subject, new LoginHandler(), new HashMap(), options );
+ boolean result = module.login();
+ result &= module.commit();
+ Object[] principals = subject.getPrincipals().toArray();
+ if ( principals.length > 0 )
+ {
+ principal = ( SafehausPrincipal ) principals[0];
+ }
+ return result;
+ }
+
+
+ public SafehausPrincipal getSafehausPrincipal()
+ {
+ return principal;
+ }
+
+
+ /**
+ * Simple handler implementation for this Demo.
+ */
+ class LoginHandler implements CallbackHandler
+ {
+ public void handle( Callback[] callbacks ) throws IOException, UnsupportedCallbackException
+ {
+ for ( int ii = 0; ii < callbacks.length; ii++ )
+ {
+ if ( callbacks[ii] instanceof NameCallback )
+ {
+ NameCallback ncb = ( NameCallback ) callbacks[ii];
+ ncb.setName( userId );
+ }
+ else if ( callbacks[ii] instanceof PasswordCallback )
+ {
+ PasswordCallback pcb = ( PasswordCallback ) callbacks[ii];
+ pcb.setPassword( password.toCharArray() );
+ }
+ else if ( callbacks[ii] instanceof RealmCallback )
+ {
+ RealmCallback rcb = ( RealmCallback ) callbacks[ii];
+ rcb.setRealm( realm );
+ }
+ else if ( callbacks[ii] instanceof PolicyCallback )
+ {
+ PolicyCallback pcb = ( PolicyCallback ) callbacks[ii];
+ pcb.setPolicy( policy );
+ }
+ else if ( callbacks[ii] instanceof PasscodeCallback )
+ {
+ PasscodeCallback pcb = ( PasscodeCallback ) callbacks[ii];
+ pcb.setPasscode( passcode );
+ }
+ }
+ }
+ }
+}
Added: directory/trunks/triplesec/webapp-servlet-demo/src/main/java/org/safehaus/triplesec/demo/LoginServlet.java
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/webapp-servlet-demo/src/main/java/org/safehaus/triplesec/demo/LoginServlet.java?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/webapp-servlet-demo/src/main/java/org/safehaus/triplesec/demo/LoginServlet.java (added)
+++ directory/trunks/triplesec/webapp-servlet-demo/src/main/java/org/safehaus/triplesec/demo/LoginServlet.java Tue Dec 12 07:23:31 2006
@@ -0,0 +1,179 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.safehaus.triplesec.demo;
+
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Iterator;
+import java.util.Properties;
+
+import javax.security.auth.login.LoginException;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.safehaus.triplesec.guardian.ApplicationPolicy;
+import org.safehaus.triplesec.guardian.ApplicationPolicyFactory;
+import org.safehaus.triplesec.guardian.Permissions;
+import org.safehaus.triplesec.guardian.Profile;
+import org.safehaus.triplesec.guardian.Roles;
+import org.safehaus.triplesec.jaas.SafehausPrincipal;
+
+
+/**
+ * Demo login servlet.
+ *
+ * @author <a href="mailto:akarasulu@safehaus.org">Alex Karasulu</a>
+ * @version $Rev$
+ */
+public class LoginServlet extends HttpServlet
+{
+ private static final long serialVersionUID = -8057005697331693436L;
+
+ // Guardian connection init parameters
+ private static final String APPLICATION_CREDENTIALS_PARAM = "applicationCredentials";
+ private static final String APPLICATION_PRINCIPAL_DN_PARAM = "applicationPrincipalDn";
+ private static final String CONNECTION_URL_PARAM = "connectionUrl";
+ private static final String REALM_PARAM = "realm";
+
+ private String realm;
+ private ApplicationPolicy policy;
+
+
+ public void init( ServletConfig config )
+ {
+ // -------------------------------------------------------------------
+ // get the realm the guardian connection URL and the application DN
+ // -------------------------------------------------------------------
+
+ realm = config.getInitParameter( REALM_PARAM );
+ String connectionUrl = config.getInitParameter( CONNECTION_URL_PARAM );
+ String applicationPrincipalDn = config.getInitParameter( APPLICATION_PRINCIPAL_DN_PARAM );
+ String applicationCredentials = config.getInitParameter( APPLICATION_CREDENTIALS_PARAM );
+
+ // -------------------------------------------------------------------
+ // setup connection parameters and initialize the application policy
+ // -------------------------------------------------------------------
+
+ Properties props = new Properties();
+ props.setProperty( "applicationPrincipalDN", applicationPrincipalDn );
+ props.setProperty( "applicationCredentials", applicationCredentials );
+ try
+ {
+ Class.forName( "org.safehaus.triplesec.guardian.ldap.LdapConnectionDriver" );
+ policy = ApplicationPolicyFactory.newInstance( connectionUrl, props );
+ }
+ catch ( Exception e )
+ {
+ e.printStackTrace();
+ }
+ }
+
+
+ protected void doGet( HttpServletRequest request, HttpServletResponse response ) throws ServletException,
+ IOException
+ {
+ doAll( request, response );
+ }
+
+
+ protected void doPost( HttpServletRequest request, HttpServletResponse response ) throws ServletException,
+ IOException
+ {
+ doAll( request, response );
+ }
+
+
+ protected void doAll( HttpServletRequest request, HttpServletResponse response ) throws ServletException,
+ IOException
+ {
+ // get the required parameters for authentication
+ String username = ( String ) request.getParameter( "username" );
+ String password = ( String ) request.getParameter( "password" );
+ String passcode = ( String ) request.getParameter( "passcode" );
+
+ // prepare and execute the login command that wraps the login module
+ LoginCommand command = new LoginCommand( username, password, realm, passcode, policy );
+ boolean result = false;
+ try
+ {
+ result = command.execute();
+ }
+ catch ( LoginException e )
+ {
+ doErrorMessage( request, response, e.getMessage() );
+ return;
+ }
+
+ if ( result == false )
+ {
+ doErrorMessage( request, response, "Failed authentication!" );
+ return;
+ }
+
+ // get the authorization profile of the authenticated user and print it out
+ SafehausPrincipal principal = command.getSafehausPrincipal();
+ Profile profile = principal.getAuthorizationProfile();
+ PrintWriter out = response.getWriter();
+ out.println( "<html><body><p><font color=\"green\">Authentication Succeeded</font></p><br/><br/>" );
+ out.println( "<h2>Authorization Profile " + profile.getProfileId()
+ + " for User " + profile.getUserName() + "</h2>" );
+
+ // print out the grants in the profile
+ out.println( "<p>Profile Grants:</p><ul>" );
+ Permissions grants = profile.getGrants();
+ for ( Iterator ii = grants.iterator(); ii.hasNext(); /**/ )
+ {
+ out.println( "<li>" + ii.next() + "</li>" );
+ }
+ out.println( "</ul>" );
+
+ // print out the denials in the profile
+ out.println( "<p>Profile Denials:</p><ul>" );
+ Permissions denials = profile.getDenials();
+ for ( Iterator ii = denials.iterator(); ii.hasNext(); /**/ )
+ {
+ out.println( "<li>" + ii.next() + "</li>" );
+ }
+ out.println( "</ul>" );
+
+ // print out the roles the profile puts the user in
+ out.println( "<p>Profile Roles:</p><ul>" );
+ Roles roles = profile.getRoles();
+ for ( Iterator ii = roles.iterator(); ii.hasNext(); /**/ )
+ {
+ out.println( "<li>" + ii.next() + "</li>" );
+ }
+ out.println( "</ul>" );
+ out.println( "</body></html>" );
+ }
+
+
+ private void doErrorMessage( HttpServletRequest request, HttpServletResponse response, String message ) throws IOException
+ {
+ PrintWriter out = response.getWriter();
+ out.println( "<html><body><p><font color=\"red\">" + message + "</font></p></body></html>" );
+ out.flush();
+ return;
+ }
+}
Added: directory/trunks/triplesec/webapp-servlet-demo/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/webapp-servlet-demo/src/main/webapp/WEB-INF/web.xml?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/webapp-servlet-demo/src/main/webapp/WEB-INF/web.xml (added)
+++ directory/trunks/triplesec/webapp-servlet-demo/src/main/webapp/WEB-INF/web.xml Tue Dec 12 07:23:31 2006
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+ <servlet>
+ <servlet-name>LoginServlet</servlet-name>
+ <servlet-class>org.safehaus.triplesec.demo.LoginServlet</servlet-class>
+ <init-param>
+ <param-name>realm</param-name>
+ <param-value>EXAMPLE.COM</param-value>
+ </init-param>
+ <init-param>
+ <param-name>connectionUrl</param-name>
+ <param-value>ldap://localhost:10389/dc=example,dc=com</param-value>
+ </init-param>
+ <init-param>
+ <param-name>applicationPrincipalDn</param-name>
+ <param-value>appName=demo,ou=Applications,dc=example,dc=com</param-value>
+ </init-param>
+ <init-param>
+ <param-name>applicationCredentials</param-name>
+ <param-value>secret</param-value>
+ </init-param>
+ <load-on-startup/>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>LoginServlet</servlet-name>
+ <url-pattern>/demo/LoginServlet</url-pattern>
+ </servlet-mapping>
+</web-app>
Added: directory/trunks/triplesec/webapp-servlet-demo/src/main/webapp/images/login-banner.png
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/webapp-servlet-demo/src/main/webapp/images/login-banner.png?view=auto&rev=486187
==============================================================================
Binary file - no diff available.
Propchange: directory/trunks/triplesec/webapp-servlet-demo/src/main/webapp/images/login-banner.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/trunks/triplesec/webapp-servlet-demo/src/main/webapp/index.html
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/webapp-servlet-demo/src/main/webapp/index.html?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/webapp-servlet-demo/src/main/webapp/index.html (added)
+++ directory/trunks/triplesec/webapp-servlet-demo/src/main/webapp/index.html Tue Dec 12 07:23:31 2006
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Login Servlet Demo</title>
+</head>
+<body>
+<body text=#000000 bgcolor=#FFFFFF link=#0000CC vlink=#000080 alink=#0000CC>
+<center><img src="images/login-banner.png"></center>
+ <center>
+ <h3>Please login:</h3>
+ </center>
+
+ <center>
+ <form action="/demo/demo/LoginServlet" method="POST">
+ Username: <input type="text" name="username"><br><br>
+ Password: <input type="password" name="password"><br><br>
+ Passcode: <input type="password" name="passcode"><br><br>
+ <br>
+ <input type="submit">
+ </form>
+ </center>
+</body>
+</html>
\ No newline at end of file
Added: directory/trunks/triplesec/webapp-servlet-demo/src/test/java/org/safehaus/triplesec/demo/RunDemoUI.java
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/webapp-servlet-demo/src/test/java/org/safehaus/triplesec/demo/RunDemoUI.java?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/webapp-servlet-demo/src/test/java/org/safehaus/triplesec/demo/RunDemoUI.java (added)
+++ directory/trunks/triplesec/webapp-servlet-demo/src/test/java/org/safehaus/triplesec/demo/RunDemoUI.java Tue Dec 12 07:23:31 2006
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.safehaus.triplesec.demo;
+
+
+
+import org.safehaus.triplesec.integration.TriplesecIntegration;
+
+
+public class RunDemoUI extends TriplesecIntegration
+{
+ public RunDemoUI() throws Exception
+ {
+ super();
+ }
+
+
+ public void testRunForever() throws Exception
+ {
+ System.out.println( "Enter any character to end this test: " );
+ System.in.read();
+ }
+}
Added: directory/trunks/triplesec/webapp-servlet-demo/src/test/org/safehaus/demo/DerbyInvestmentsTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/webapp-servlet-demo/src/test/org/safehaus/demo/DerbyInvestmentsTest.java?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/webapp-servlet-demo/src/test/org/safehaus/demo/DerbyInvestmentsTest.java (added)
+++ directory/trunks/triplesec/webapp-servlet-demo/src/test/org/safehaus/demo/DerbyInvestmentsTest.java Tue Dec 12 07:23:31 2006
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.safehaus.demo;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+
+import org.apache.derby.jdbc.EmbeddedDriver;
+
+import junit.framework.TestCase;
+
+
+public class DerbyInvestmentsTest extends TestCase
+{
+ Connection c;
+
+ public void setUp() throws Exception
+ {
+ DriverManager.registerDriver( new EmbeddedDriver() );
+ c = DriverManager.getConnection( "jdbc:derby:testdb;create=true" );
+ InvestmentsAccessObject dao = new InvestmentsAccessObject( c );
+
+ try
+ {
+ dao.dropTable();
+ }
+ catch ( SQLException e )
+ {
+ }
+
+ dao.createTable();
+ Investments investments = new Investments( "akarasulu" );
+ investments.set( 0, 1000 );
+ investments.set( 1, 1000 );
+ investments.set( 2, 1000 );
+ investments.set( 3, 1000 );
+ investments.set( 4, 1000 );
+ dao.insert( investments );
+ }
+
+
+ public void tearDown() throws Exception
+ {
+ InvestmentsAccessObject dao = new InvestmentsAccessObject( c );
+ try
+ {
+ dao.dropTable();
+ }
+ catch ( SQLException e )
+ {
+ }
+ c.close();
+ c = null;
+ }
+
+
+ public void testInsertInvestment() throws Exception
+ {
+ Investments investments = new Investments( "testuser" );
+ investments.setBonds( 100 );
+ InvestmentsAccessObject dao = new InvestmentsAccessObject( c );
+ dao.insert( investments );
+ Investments inserted = dao.getInvestments( "testuser" );
+ assertNotNull( inserted );
+ assertEquals( inserted.getUid(), "testuser" );
+ assertEquals( inserted.getBonds(), 100 );
+ assertEquals( inserted.getEmergingMarkets(), 10000 );
+ assertEquals( inserted.getTbills(), 10000 );
+ assertEquals( inserted.getTechStocks(), 10000 );
+ assertEquals( inserted.getVolatileHighYield(), 10000 );
+ }
+
+
+ public void testDeleteInvestment() throws Exception
+ {
+ InvestmentsAccessObject dao = new InvestmentsAccessObject( c );
+ dao.delete( "akarasulu" );
+ Investments inserted = dao.getInvestments( "akarasulu" );
+ assertNull( inserted );
+ }
+
+
+ public void testUpdateInvestment() throws Exception
+ {
+ InvestmentsAccessObject dao = new InvestmentsAccessObject( c );
+ Investments investments = dao.getInvestments( "akarasulu" );
+ assertNotNull( investments );
+ investments.setBonds( 12345 );
+ investments.setVolatileHighYield( 54321 );
+ dao.update( investments );
+ investments = null;
+ investments = dao.getInvestments( "akarasulu" );
+ assertNotNull( investments );
+ assertEquals( 12345, investments.getBonds() );
+ assertEquals( 54321, investments.getVolatileHighYield() );
+ assertEquals( 1000, investments.getTechStocks() );
+ }
+
+
+ public void testGetInvestment() throws Exception
+ {
+ InvestmentsAccessObject dao = new InvestmentsAccessObject( c );
+ Investments investments = dao.getInvestments( "akarasulu" );
+ assertNotNull( investments );
+ assertEquals( investments.getUid(), "akarasulu" );
+ assertEquals( investments.getBonds(), 1000 );
+ assertEquals( investments.getEmergingMarkets(), 1000 );
+ assertEquals( investments.getTbills(), 1000 );
+ assertEquals( investments.getTechStocks(), 1000 );
+ assertEquals( investments.getVolatileHighYield(), 1000 );
+ }
+}
Added: directory/trunks/triplesec/webapp-servlet-demo/src/test/org/safehaus/demo/JaasTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/webapp-servlet-demo/src/test/org/safehaus/demo/JaasTest.java?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/webapp-servlet-demo/src/test/org/safehaus/demo/JaasTest.java (added)
+++ directory/trunks/triplesec/webapp-servlet-demo/src/test/org/safehaus/demo/JaasTest.java Tue Dec 12 07:23:31 2006
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.safehaus.demo;
+
+
+import com.sun.security.auth.module.Krb5LoginModule;
+import junit.framework.TestCase;
+
+import javax.security.auth.spi.LoginModule;
+import javax.security.auth.Subject;
+import javax.security.auth.login.LoginException;
+import javax.security.auth.callback.*;
+import java.util.HashMap;
+import java.util.Map;
+import java.io.IOException;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+
+
+/**
+ * Simple test to make sure Jaas authentication is working. This test gets
+ * bypassed without setting the demo.test.interactive property.
+ *
+ * @author <a href="mailto:akarasulu@safehaus.org">Alex Karasulu</a>
+ * @version $Rev$
+ */
+public class JaasTest extends TestCase
+{
+ /** controls whether or not authentication is actually conducted */
+ public static final String INTERACTIVE_KEY = "demo.test.interactive";
+
+ LoginModule module = null;
+
+
+ protected void setUp() throws Exception
+ {
+ module = new Krb5LoginModule();
+ }
+
+
+ protected void tearDown() throws Exception
+ {
+ module = null;
+ }
+
+
+ public void testLogin() throws LoginException
+ {
+ if ( ! System.getProperties().containsKey( INTERACTIVE_KEY ) )
+ {
+ System.err.println( "WARN: Interactive test bypassed - set demo.test.interactive=true to enable." );
+
+ return;
+ }
+
+ String val = ( ( String ) System.getProperties().get( INTERACTIVE_KEY ) ).trim().toLowerCase();
+
+ if ( ! val.equals( "true " ) || ! val.equals( "yes" ) || ! val.equals( "on" ) || ! val.equals( "1") )
+ {
+ System.err.println( "WARN: Interactive test bypassed - set demo.test.interactive=true to enable." );
+
+ return;
+ }
+
+ Map state = new HashMap();
+
+ Map options = new HashMap();
+
+ Subject subject = new Subject();
+
+ CallbackHandler handler = new Handler();
+
+ module.initialize( subject, handler, state, options );
+
+ boolean result = module.login();
+
+ if ( result )
+ {
+ System.out.println( "Authentication SUCCESS!" );
+ }
+ else
+ {
+ System.out.println( "Authentication FAILURE!" );
+ }
+
+ module.commit();
+ }
+
+
+ class Handler implements CallbackHandler
+ {
+ public void handle( Callback[] callbacks ) throws IOException, UnsupportedCallbackException
+ {
+ for ( int ii = 0; ii < callbacks.length; ii++ )
+ {
+ if ( callbacks[ii] instanceof TextOutputCallback )
+ {
+ TextOutputCallback tocb = ( TextOutputCallback ) callbacks[ii];
+
+ switch( tocb.getMessageType() )
+ {
+ case( TextOutputCallback.INFORMATION ):
+
+ System.out.println( tocb.getMessage() );
+
+ break;
+
+ case( TextOutputCallback.WARNING ):
+
+ System.out.println( "WARNING: " + tocb.getMessage() );
+
+ break;
+
+ case( TextOutputCallback.ERROR ):
+
+ System.err.println( "ERROR: " + tocb.getMessage() );
+
+ break;
+
+ default:
+
+ throw new IllegalStateException( "unsupported message type" );
+ }
+ }
+
+ else if ( callbacks[ii] instanceof NameCallback )
+ {
+ NameCallback ncb = ( NameCallback ) callbacks[ii];
+
+ System.err.print( ncb.getPrompt() );
+
+ System.err.flush();
+
+ ncb.setName( ( new BufferedReader( new InputStreamReader( System.in ) ) ).readLine() );
+ }
+
+ else if ( callbacks[ii] instanceof PasswordCallback )
+ {
+ PasswordCallback pcb = ( PasswordCallback ) callbacks[ii];
+
+ System.err.print( pcb.getPrompt() );
+
+ System.err.flush();
+
+ pcb.setPassword( ( new BufferedReader( new InputStreamReader( System.in ) ) ).readLine().toCharArray() );
+ }
+ }
+ }
+ }
+}
Added: directory/trunks/triplesec/webapp-servlet-demo/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/webapp-servlet-demo/src/test/resources/log4j.properties?view=auto&rev=486187
==============================================================================
--- directory/trunks/triplesec/webapp-servlet-demo/src/test/resources/log4j.properties (added)
+++ directory/trunks/triplesec/webapp-servlet-demo/src/test/resources/log4j.properties Tue Dec 12 07:23:31 2006
@@ -0,0 +1,11 @@
+# Set root logger level to DEBUG and its only appender to A1.
+log4j.rootLogger=INFO, A1
+
+# A1 is set to be a ConsoleAppender.
+log4j.appender.A1=org.apache.log4j.ConsoleAppender
+
+# A1 uses PatternLayout.
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
+
+