Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 28576 invoked from network); 12 Dec 2006 15:27:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Dec 2006 15:27:05 -0000 Received: (qmail 52517 invoked by uid 500); 12 Dec 2006 15:27:12 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 52478 invoked by uid 500); 12 Dec 2006 15:27:12 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 52467 invoked by uid 99); 12 Dec 2006 15:27:12 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Dec 2006 07:27:12 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Dec 2006 07:26:50 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id 04B8E1A989E; Tue, 12 Dec 2006 07:24:43 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: 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... Date: Tue, 12 Dec 2006 15:24:14 -0000 To: commits@directory.apache.org From: tbennett@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20061212152443.04B8E1A989E@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 @@ + + + + + +

If you're not redirected to the Registration Interface

then select this link. + + \ 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 @@ + + + + + + + + + simple + uid=admin,ou=system + secret + dc=example,dc=com + org.safehaus.triplesec.store.ProfileStateFactory + org.safehaus.triplesec.store.ProfileObjectFactory + + EXAMPLE.COM + krbtgt/EXAMPLE.COM@EXAMPLE.COM + des-cbc-md5 des3-cbc-sha1 des3-cbc-md5 des-cbc-md4 des-cbc-crc + ou=users,dc=example,dc=com + secret + + ou=users,dc=example,dc=com + secret + kadmin/changepw@EXAMPLE.COM + + + 5 + 1440 + 10080 + true + true + true + true + true + true + + ou=Users,dc=example,dc=com + true + org.safehaus.triplesec.verifier.hotp.DefaultHotpSamVerifier + + + + + + partitions + false + true + 10389 + true + false + true + + + + + + + + + + + + + + + + + + + + + + + + true + 6 + midletNameAttribute + + + + + + hauskeys + secret + demo + http://www.nbroadcasting.com/customers/messages/Sender.asp + + + + + + false + + localhost + Triplesec Account Activated + dev@safehaus.org + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + normalizationService + + + + + + authenticationService + + + + + + referralService + + + + + + authorizationService + + + + + + defaultAuthorizationService + + + + + + exceptionService + + + + + + schemaService + + + + + + subentryService + + + + + + operationalAttributeService + + + + + + collectiveAttributeService + + + + + + eventService + + + + + + policyProtectionService + + + + + + + + + + example + dc=example,dc=com + + + objectClass + ou + dc + uid + profileId + roles + grants + denials + krb5PrincipalName + + + + + objectClass: top + objectClass: domain + objectClass: extensibleObject + dc: example + administrativeRole: accessControlSpecificArea + administrativeRole: collectiveAttributeSpecificArea + + + + + + + + + + + + + + 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 @@ + + + + 4.0.0 + + org.safehaus.triplesec + build + 1.0-SNAPSHOT + + triplesec-webapp-root + Triplesec Webapp for Root + war + + + tomcat + servlet-api + 5.5.12 + provided + + + + triplesec-webapp-root + + 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 @@ + + + webroot + + index.html + index.htm + index.jsp + default.html + default.htm + default.jsp + + 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 @@ + + + + +Triplesec Server + + + +

Triplesec Console

+ + + + + + + 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 @@ + + + + 4.0.0 + + org.safehaus.triplesec + build + 1.0-SNAPSHOT + + triplesec-webapp-servlet-demo + Triplesec Webapp Servlet Demo + war + + + + apachecvs + Apache Snapshot Repository + http://cvs.apache.org/maven-snapshot-repository + + + + safehaus + Alternate Repository for Safehaus Artifacts + http://m2.safehaus.org + + + + + ${project.groupId} + triplesec-jaas + ${project.version} + + + ${project.groupId} + triplesec-guardian-ldap + ${project.version} + + + org.slf4j + nlog4j + 1.2.25 + + + ${pom.groupId} + triplesec-integration + ${pom.version} + test + + + tomcat + servlet-api + 5.5.12 + provided + + + + triplesec-servlet-demo + + + + + default + + true + + + + + maven-surefire-plugin + + + + **/RunDemoUI.java + + **/*ITest.java + **/*IntegrationTest.java + + + + + + + + integration + + integration + + + + + maven-surefire-plugin + + + + org.safehaus.triplesec.integration.resourcesDirectory + ${basedir}/src/test/resources + + + + + **/RunDemoUI.java + + + + + + + + ui + + ui + + + + + maven-surefire-plugin + + + + org.safehaus.triplesec.integration.resourcesDirectory + ${basedir}/src/test/resources + + + org.safehaus.triplesec.integration.webapps + demo + + + org.safehaus.triplesec.integration.webappWarBase.demo + ${basedir}/target/triplesec-servlet-demo.war + + + + **/RunDemoUI.java + + + **/*Test.java + + + + + + + + + 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 Alex Karasulu + * @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 Alex Karasulu + * @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( "

Authentication Succeeded



" ); + out.println( "

Authorization Profile " + profile.getProfileId() + + " for User " + profile.getUserName() + "

" ); + + // print out the grants in the profile + out.println( "

Profile Grants:

    " ); + Permissions grants = profile.getGrants(); + for ( Iterator ii = grants.iterator(); ii.hasNext(); /**/ ) + { + out.println( "
  • " + ii.next() + "
  • " ); + } + out.println( "
" ); + + // print out the denials in the profile + out.println( "

Profile Denials:

    " ); + Permissions denials = profile.getDenials(); + for ( Iterator ii = denials.iterator(); ii.hasNext(); /**/ ) + { + out.println( "
  • " + ii.next() + "
  • " ); + } + out.println( "
" ); + + // print out the roles the profile puts the user in + out.println( "

Profile Roles:

    " ); + Roles roles = profile.getRoles(); + for ( Iterator ii = roles.iterator(); ii.hasNext(); /**/ ) + { + out.println( "
  • " + ii.next() + "
  • " ); + } + out.println( "
" ); + out.println( "" ); + } + + + private void doErrorMessage( HttpServletRequest request, HttpServletResponse response, String message ) throws IOException + { + PrintWriter out = response.getWriter(); + out.println( "

" + message + "

" ); + 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 @@ + + + + + LoginServlet + org.safehaus.triplesec.demo.LoginServlet + + realm + EXAMPLE.COM + + + connectionUrl + ldap://localhost:10389/dc=example,dc=com + + + applicationPrincipalDn + appName=demo,ou=Applications,dc=example,dc=com + + + applicationCredentials + secret + + + + + + LoginServlet + /demo/LoginServlet + + 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 @@ + + + + +Login Servlet Demo + + + +
+
+

Please login:

+
+ +
+
+ Username:

+ Password:

+ Passcode:

+
+ +
+
+ + \ 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 Alex Karasulu + * @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 + +