Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 28663 invoked from network); 12 Dec 2006 15:27:08 -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:08 -0000 Received: (qmail 52703 invoked by uid 500); 12 Dec 2006 15:27:15 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 52665 invoked by uid 500); 12 Dec 2006 15:27:15 -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 52654 invoked by uid 99); 12 Dec 2006 15:27:15 -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:15 -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:53 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id 329FC1A9826; 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 [49/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.329FC1A9826@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Added: directory/trunks/triplesec/webapp-wicket-admin/src/main/webapp/WEB-INF/web.xml URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/webapp-wicket-admin/src/main/webapp/WEB-INF/web.xml?view=auto&rev=486187 ============================================================================== --- directory/trunks/triplesec/webapp-wicket-admin/src/main/webapp/WEB-INF/web.xml (added) +++ directory/trunks/triplesec/webapp-wicket-admin/src/main/webapp/WEB-INF/web.xml Tue Dec 12 07:23:31 2006 @@ -0,0 +1,41 @@ + + + + + + Triplesec Admin + + TriplesecAdminApplication + wicket.protocol.http.WicketServlet + + applicationClassName + org.safehaus.triplesec.adminui.view.TriplesecAdminApplication + + 1 + + + TriplesecAdminApplication + /admin/* + + Added: directory/trunks/triplesec/webapp-wicket-admin/src/main/webapp/css/style.css URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/webapp-wicket-admin/src/main/webapp/css/style.css?view=auto&rev=486187 ============================================================================== --- directory/trunks/triplesec/webapp-wicket-admin/src/main/webapp/css/style.css (added) +++ directory/trunks/triplesec/webapp-wicket-admin/src/main/webapp/css/style.css Tue Dec 12 07:23:31 2006 @@ -0,0 +1,187 @@ +body +{ + text-align:center; + font-family:arial, times,sans-serif; + font-size:12px; + color:#666666; + background-color:white; + width:800px; + margin-left:auto; + margin-right:auto; +} + +h1 +{ + margin-top:10px; + font-size:28px; + color:#FFBA27; + font-weight:normal; +} + + +h2 +{ + font-size:20px; + color:#CCCCCC; + font-weight:normal; + margin-top:-18px; +} + +h3 +{ + font-size:14px; + color:#FFBA27; + font-weight:normal; + border: 1px solid #AAAAAA; + margin:0; + height:16px; + padding:5px 5px 5px 5px; + background:#F7F7F7; +} + +#top +{ + text-align:left; + width:800px; + border-bottom: 1px solid #CCCCCC; +} + +#container +{ + width:800px; +} + +#sideMenu +{ + margin-top:15px; + border-right:1px solid #CCCCCC; + width:160px; + position:relative; + margin-right:18px; + text-align:left; + float:left; + padding:0; +} + +#announcement +{ + margin-top:65px; + width:155px; + position:relative; + /*margin-left:-15px;*/ + margin-left:0px; + margin-right:8px; + float:left; + padding:0px 0px 0px 0px; +} + +a +{ + font-family:arial; + color:#FFBA27; + font-size:16px; + white-space : nowrap; + text-decoration:none; +} + +a.inText +{ + color:#FFBA27; + font-size:12px; + white-space : nowrap; + text-decoration:none; +} + +#panelcontent +{ + padding:9px 9px 9px 9px; + margin-top:-1px; + border:1px solid #AAAAAA; + + margin-left:0px; + + font-family:normal; + font-family:arial, times,sans-serif; + font-size:12px; + + word-spacing:2px; + color:#AAaAAA; + line-height:1.4em; +} + +a:hover +{ + text-decoration:underline; +} + +#MainCopy +{ + margin:0; + /*margin-left:200px;*/ + margin-top:15px; +} + +#content +{ + margin-top:15px; + width:590px; + text-align:left; + margin:0; + padding:0px 0px 0px 0px; + float: left; +} + +p.assistiveText +{ + border:none; + padding:0; + display:block; + margin-top:0px; + margin-bottom:1px; +} + +li.menu +{ + margin:0px 0px 0px 0px; + padding: 0px 0px 0px 0px; +} + +ul.menu +{ + color:#AAAAAA; + list-style-type:none; + margin: 0px 0px 0px 0px; + padding: 0px 0px 0px 0px; +} + +#footer +{ + margin-top:40px; + text-align:right; + width:800px; + border-top:1px solid #CCCCCC; + font-family:arial, times,sans-serif; + font-size:12px; + clear:both; + color:#AAaAAA; +} + +label { + float: left; + width: 140px; + font-weight: bold; +} + +input, textarea { + width: 180px; + margin-bottom: 5px; +} + +textarea { + width: 250px; + height: 150px; +} + +.boxes { + width: 1em; +} \ No newline at end of file Added: directory/trunks/triplesec/webapp-wicket-admin/src/main/webapp/images/background.png URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/webapp-wicket-admin/src/main/webapp/images/background.png?view=auto&rev=486187 ============================================================================== Binary file - no diff available. Propchange: directory/trunks/triplesec/webapp-wicket-admin/src/main/webapp/images/background.png ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: directory/trunks/triplesec/webapp-wicket-admin/src/main/webapp/index.html URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/webapp-wicket-admin/src/main/webapp/index.html?view=auto&rev=486187 ============================================================================== --- directory/trunks/triplesec/webapp-wicket-admin/src/main/webapp/index.html (added) +++ directory/trunks/triplesec/webapp-wicket-admin/src/main/webapp/index.html Tue Dec 12 07:23:31 2006 @@ -0,0 +1,8 @@ + + + + + +

If you're not redirected to the Admin Interface

then select this link. + + \ No newline at end of file Added: directory/trunks/triplesec/webapp-wicket-admin/src/test/java/org/safehaus/triplesec/wicket/admin/RunWicketAdminUI.java URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/webapp-wicket-admin/src/test/java/org/safehaus/triplesec/wicket/admin/RunWicketAdminUI.java?view=auto&rev=486187 ============================================================================== --- directory/trunks/triplesec/webapp-wicket-admin/src/test/java/org/safehaus/triplesec/wicket/admin/RunWicketAdminUI.java (added) +++ directory/trunks/triplesec/webapp-wicket-admin/src/test/java/org/safehaus/triplesec/wicket/admin/RunWicketAdminUI.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.wicket.admin; + + + +import org.safehaus.triplesec.integration.TriplesecIntegration; + + +public class RunWicketAdminUI extends TriplesecIntegration +{ + public RunWicketAdminUI() 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-wicket-admin/src/test/resources/log4j.properties URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/webapp-wicket-admin/src/test/resources/log4j.properties?view=auto&rev=486187 ============================================================================== --- directory/trunks/triplesec/webapp-wicket-admin/src/test/resources/log4j.properties (added) +++ directory/trunks/triplesec/webapp-wicket-admin/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-wicket-admin/src/test/resources/server.ldif URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/webapp-wicket-admin/src/test/resources/server.ldif?view=auto&rev=486187 ============================================================================== --- directory/trunks/triplesec/webapp-wicket-admin/src/test/resources/server.ldif (added) +++ directory/trunks/triplesec/webapp-wicket-admin/src/test/resources/server.ldif Tue Dec 12 07:23:31 2006 @@ -0,0 +1,545 @@ +# +# 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 Added: directory/trunks/triplesec/webapp-wicket-admin/src/test/resources/server.xml URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/webapp-wicket-admin/src/test/resources/server.xml?view=auto&rev=486187 ============================================================================== --- directory/trunks/triplesec/webapp-wicket-admin/src/test/resources/server.xml (added) +++ directory/trunks/triplesec/webapp-wicket-admin/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/wicket-tools/pom.xml URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/wicket-tools/pom.xml?view=auto&rev=486187 ============================================================================== --- directory/trunks/triplesec/wicket-tools/pom.xml (added) +++ directory/trunks/triplesec/wicket-tools/pom.xml Tue Dec 12 07:23:31 2006 @@ -0,0 +1,37 @@ + + + + 4.0.0 + + org.safehaus.triplesec + build + 1.0-SNAPSHOT + + triplesec-wicket-tools + Triplesec Wicket Tools + jar + + + wicket + wicket + 1.2-beta2 + + + Added: directory/trunks/triplesec/wicket-tools/src/main/java/wicket/examples/wizard/ezwizard/impl/Wizard.java URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/wicket-tools/src/main/java/wicket/examples/wizard/ezwizard/impl/Wizard.java?view=auto&rev=486187 ============================================================================== --- directory/trunks/triplesec/wicket-tools/src/main/java/wicket/examples/wizard/ezwizard/impl/Wizard.java (added) +++ directory/trunks/triplesec/wicket-tools/src/main/java/wicket/examples/wizard/ezwizard/impl/Wizard.java Tue Dec 12 07:23:31 2006 @@ -0,0 +1,349 @@ +/* + * 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 wicket.examples.wizard.ezwizard.impl; + +import wicket.examples.wizard.ezwizard.intf.IWizard; +import wicket.examples.wizard.ezwizard.intf.IWizardStep; +import wicket.examples.wizard.ezwizard.intf.IWizardTransition; +import wicket.examples.wizard.ezwizard.intf.IWizardListener; + +import java.util.Map; +import java.util.HashMap; +import java.util.Iterator; + +/** + * This class containts base implementation of wizard controller and handles + * wizard traversal. The wizard controller contains references to wizard states + * and transitions, and allows to move from one state to another. + *

+ * The UI specifics like reporting of error messages should be handled by + * descendant classes. + * + * @version 0.5 + * @author Michael Jouravlev + */ +public class Wizard implements IWizard { + + /************************************************************************** + * Error messages + **************************************************************************/ + + /** + * Error list. Key is either string message or ID of a message in + * a property file. Value is a string array of values, or null if there + * are no arguments. + *

+ * Errors are initialized in backing bean when a wizard object is created. + * Reference to existing error object must be passed + * to this wizard controller from backing bean. + */ + protected Map errors = new HashMap(); + + /** + * Standard implementation returns a dummy map for error messages in + * case the concrete implementation generates messages externally and + * does not provide message placeholder. + *

+ * Concrete implementation must provide a valid reference to message map, + * if it wants to return messages from Rule Engine. + * + * @return message placeholder map + */ + public Map getWizardErrors() {return errors;} + + /** + * Returns true if wizard has been successfully completed. Wizard + * is usually completes on its last step, after business accounts is updated. + * Completed status is retained by the wizard until wizard instance + * is disposed. + * + * @return true if wizard has been successfully completed and is ready + * to be disposed. + */ + public boolean isCompleted() {return currentState == null;} + + /************************************************************************** + * IWizard implementation + **************************************************************************/ + + /** + * The intial state of this wizard. A wizard has only one initial state. + */ + protected IWizardStep sourceState; + + /** + * Returns source state of this wizard. A wizard has only one initial state. + * @return source state of this wizard + */ + public IWizardStep getSourceStep() {return sourceState;} + + /** + * Current state of this wizard. + */ + protected IWizardStep currentState; + /** + * Returns current state of this wizard; on wizard startup is the same as + * source state. + * @return current state of this wizard + */ + public IWizardStep getCurrentStep() {return currentState;} + + /** + * Locates a state in this wizard by its name + * + * @param name state name + * @return the first state starting from source, + * which name is equal to the needed name, or null + * if the state not found. + */ + public IWizardStep getStepByName(String name) { + IWizardStep sourceNode = getSourceStep(); + if (sourceNode == null) return null; + if (sourceNode.getStateName().equals(name)) return sourceNode; + return findNode(sourceNode, name); + } + + /** + * Tries to move to the next state. If cannot move, keeps current state. + */ + public boolean forward() { + + if (isCompleted()) { + return false; + } + + clearWizardErrors(); + + /* + * Find outgoing transition, returns null if current state + * is the last state + */ + IWizardTransition outgoingTransition = currentState.getOutgoingTransition(); + + /* + * Process final node, it may set "completed" status + */ + if (isLastStep()) { + boolean canLeave = canLeave(IWizardListener.STEP_LAST); + if (canLeave) { + currentState = null; + } + return canLeave; + + /* + * Not last step and about to move forward + */ + } else if (outgoingTransition != null) { + + /* + * Find next state + */ + IWizardStep nextState = outgoingTransition.getTarget(); + if (nextState == null) return false; + + /* + * Cannot move forward + */ + if (!canLeave(IWizardListener.STEP_REGULAR)) { + return false; + } + + /* + * Moving forward: set incoming transition for next state + * unless next state is not a checkpoint + */ + nextState.setIncomingTransition(currentState.isCheckpoint() ? + null : + outgoingTransition); + + /* + * Move to the next node + */ + currentState = nextState; + return true; + + /* + * Wizard stayed on the same step + */ + } else { + return false; + } + } + + /** + * Tries to move to the previous state. Stays on the current state + * if traversal back is impossible either because this state is + * the initial wizard state or was marked as checkpoint. + */ + public boolean back() { + + if (isCompleted()) { + return false; + } + + /* + * Find the incoming transition for the current state + */ + IWizardTransition incomingTransition = currentState.getIncomingTransition(); + + /* + * Traverse back if incoming transition exists + */ + if (incomingTransition != null) { + currentState = incomingTransition.getSource(); + clearWizardErrors(); + return true; + } + return false; + } + + /** + * Verifies is current wizard step a last step. + * @return true if current wizard step a last step + */ + protected boolean isLastStep() { + IWizardTransition[] transitions = currentState.getOutgoingTransitions(); + return transitions == null || transitions.length == 0; + } + + /** + * Executed after the forward transition is chosen, but before the state + * is changed. Verifies with listening application, is it allowed to + * perform a state change + * @param event event that is occurring now, like moving to next step + * @return true if all listeners allow to move to the next step + */ + protected boolean canLeave(int event) { + boolean canLeave = true; + Iterator lisIte = getListeners().values().iterator(); + while(lisIte.hasNext()) { + IWizardListener wizardListener = (IWizardListener) lisIte.next(); + canLeave &= wizardListener.onTransition(event); + } + return canLeave; + } + + /** + * Returns a name which is used to display proper wizard panel. + * @return mapping name for a wizard view, usually path to JSP page + */ + public String getCurrentStepName() { + IWizardStep currentStep = getCurrentStep(); + return currentStep == null ? null : getCurrentStep().getStateName(); + } + + /** + * Listeners, checking for state transition + */ + protected Map listeners = new HashMap(); + + /** + * Adds a listener for state change event. + */ + public void addListener(IWizardListener listener) { + synchronized(listeners) { + listeners.put(listener.getClass().getName(), listener); + } + } + + /** + * Removes a listener for state change event. + */ + public void removeListener(IWizardListener listener) { + synchronized(listeners) { + Iterator lisIte = listeners.values().iterator(); + while(lisIte.hasNext()) { + IWizardListener wizardListener = (IWizardListener) lisIte.next(); + if (wizardListener == listener) { + lisIte.remove(); + } + } + } + } + + /** + * Removes all wizard listeners for state change event. + */ + public void removeAllListeners() { + synchronized(listeners) { + listeners.clear(); + } + } + + /** + * Returns all current listeners for wizard event + */ + public Map getListeners() { + return listeners; + } + + /************************************************************************** + * Helper methods + **************************************************************************/ + + /** + * Finds a state by its name. Need to pass staring state as an argument + * because of the recursive calls. Starting state parameter allows + * to search from any state. + *

+ * Important: starting state itself is not checked + * + * @param state the state where to start search, this state itself is not + * verified and must be checked outside this method + * @param name the name of the state to look for + * @return the state with the needed name, or null if state not found + */ + public static IWizardStep findNode(IWizardStep state, String name) { + if (state == null || name == null) return null; + IWizardTransition[] transitions = state.getOutgoingTransitions(); + if (transitions != null) { + for (int i = 0; i < transitions.length; i++) { + IWizardStep probedState = transitions[i].getTarget(); + IWizardStep resultState = + name.equals(probedState.getStateName()) ? + probedState : + findNode(probedState, name); + if (resultState != null) return resultState; + } + } + return null; + } + + /************************************************************************** + * Implementing IWizardManager + **************************************************************************/ + + /** + * Clear wizard errors. Does nothing here (need to implement). + * Backing bean will clear errors when needed. + */ + public void clearWizardErrors() { + Map errors = getWizardErrors(); + if (errors != null && errors.size() > 0) { + errors.clear(); + } + } + + public void wizardReset() { +// clearWizardErrors(); + getCurrentStep().resetBooleans(); + } + +} Added: directory/trunks/triplesec/wicket-tools/src/main/java/wicket/examples/wizard/ezwizard/impl/WizardStep.java URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/wicket-tools/src/main/java/wicket/examples/wizard/ezwizard/impl/WizardStep.java?view=auto&rev=486187 ============================================================================== --- directory/trunks/triplesec/wicket-tools/src/main/java/wicket/examples/wizard/ezwizard/impl/WizardStep.java (added) +++ directory/trunks/triplesec/wicket-tools/src/main/java/wicket/examples/wizard/ezwizard/impl/WizardStep.java Tue Dec 12 07:23:31 2006 @@ -0,0 +1,253 @@ +/* + * 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 wicket.examples.wizard.ezwizard.impl; + + +import wicket.examples.wizard.ezwizard.intf.*; + +import java.util.ArrayList; + + +/** + * Represents a state of a wizard Finite State Machine (FSM). Contains common + * navigation methods. Derived concrete state should also contain + * setters/getters for domain data, relevant to this state. + * + * @version 0.5 + * @author Michael Jouravlev + */ +public abstract class WizardStep implements IWizardStep +{ + + /*************************************************************************** + * IWizardStep implementation + **************************************************************************/ + + /** + * Checkpoint flag. If set, then wizard cannot return back from this state. + */ + private boolean checkpoint; + + + /** + * Returns true if this state is marked as checkpoint + * + * @return true if this state is marked as checkpoint + */ + public boolean isCheckpoint() + { + return checkpoint; + } + + + /** + * Sets this state as checkpoint. This should be done before wizard is + * traversed back from this state. + * + * @param checkpoint + * true if this state should be marked as checkpoint + */ + public void setCheckpoint( boolean checkpoint ) + { + this.checkpoint = checkpoint; + } + + /** + * The name of this state + */ + protected String stateName; + + + /** + * Returns the state name + * + * @return state name + */ + public String getStateName() + { + return stateName; + } + + /** + * Master wizard object; this reference can be used to access common data + * defined in the wizard object itself. + */ + protected IWizard wizard; + + + /** + * Returns master wizard object + * + * @return master wizard object + */ + public IWizard getWizard() + { + return wizard; + } + + /** + * Incoming transition. + */ + protected IWizardTransition incomingTransition; + + + /** + * Returns incoming transition for this state, used during actual wizard + * traversal + * + * @return incoming transition for this node + */ + public IWizardTransition getIncomingTransition() + { + return incomingTransition; + } + + + /** + * Sets incoming transition, used by wizard controller. Defined as public + * because it belongs to the IWizardStep interface. + * + * @param value + * incoming transition + */ + public void setIncomingTransition( IWizardTransition value ) + { + incomingTransition = value; + } + + /** + * In this version outgoing trasitions are implemented as array list for + * easy adding of new transitions. + */ + private ArrayList outgoingTransitions = new ArrayList(); + + + /** + * Returns array of outgoing transitions in the same order in which they + * were added by addOutgoingTransition() method. + * + * @return array of outbound transitions, the transition with the most + * weight is returned first. + */ + public IWizardTransition[] getOutgoingTransitions() + { + return ( IWizardTransition[] ) outgoingTransitions.toArray( new IWizardTransition[0] ); + } + + + /** + * Adds an outgoing transition. Transitions must be added in the order of + * their weight, the edge with highest weight must be added first.
+ *
+ * Future versions may support dynamic adjustment of weight, this version + * does not support it. + * + * @param value + * outgoing transition + */ + public void addOutgoingTransition( IWizardTransition value ) + { + /* + * Add a transition as outgoing, and set this state as the source state + * for the transition. Transition objects are not shared between states. + */ + outgoingTransitions.add( value ); + value.setSource( this ); + } + + + /** + * Returns a transition which will be chosen if a "next" command is selected + * for this node.
+ *
+ * All outbound transitions are validated in the order they were added to + * this state. The first valid transition is chosen. + * + * @return a first valid outgoing transition or null if no valid transitions + * found + */ + public IWizardTransition getOutgoingTransition() + { + IWizardTransition[] edges = this.getOutgoingTransitions(); + for ( int i = 0; i < edges.length; i++ ) + { + if ( edges[i].validate() ) + { + return edges[i]; + } + } + return null; + } + + + /** + * Verifies that this state is included in the path to the current state + * (the current state is past this state). + * + * @return true if this state is found in the actual path from the initial + * state to the current state; false otherwise. + */ + public boolean isStateInPath() + { + return ( this == wizard.getCurrentStep() || checkTraverseBack( wizard.getCurrentStep(), this ) ); + } + + + /*************************************************************************** + * Helpers and constructor + **************************************************************************/ + + /** + * Verifies if a state is included in the path to the current state + * + * @param startState + * the state where to start backward traversal + * @param searchState + * the state which we are looking for in the travseral path + * @return true if searchNode is found in the actual path while traversing + * back from startNode; false otherwise. + */ + public static boolean checkTraverseBack( IWizardStep startState, IWizardStep searchState ) + { + IWizardTransition incomingEdge = startState.getIncomingTransition(); + if ( incomingEdge == null ) + return false; + IWizardStep srcState = incomingEdge.getSource(); + return srcState == searchState ? true : checkTraverseBack( srcState, searchState ); + } + + + /** + * Constructs the state, sets a name and stores a reference to the owner + * wizard object. + * + * @param owner + * owner wizard object, cannot be null + * @param name + * name of this state, cannot be null, must be unique within the + * wizard + */ + public WizardStep( IWizard owner, String name ) + { + this.wizard = owner; + this.stateName = name; + } +} Added: directory/trunks/triplesec/wicket-tools/src/main/java/wicket/examples/wizard/ezwizard/impl/WizardTransition.java URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/wicket-tools/src/main/java/wicket/examples/wizard/ezwizard/impl/WizardTransition.java?view=auto&rev=486187 ============================================================================== --- directory/trunks/triplesec/wicket-tools/src/main/java/wicket/examples/wizard/ezwizard/impl/WizardTransition.java (added) +++ directory/trunks/triplesec/wicket-tools/src/main/java/wicket/examples/wizard/ezwizard/impl/WizardTransition.java Tue Dec 12 07:23:31 2006 @@ -0,0 +1,101 @@ +/* + * 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 wicket.examples.wizard.ezwizard.impl; + +import wicket.examples.wizard.ezwizard.intf.IWizard; +import wicket.examples.wizard.ezwizard.intf.IWizardStep; +import wicket.examples.wizard.ezwizard.intf.IWizardTransition; + +/** + * Represents a state transition. In Easy Wizard a transition is an object, it + * can refer to its source and target states, and can validate itself. When + * wizard controller moves from one state to another, it iterates through + * transitions of current state, and validates each of them in order of their + * weight. The first valid transition is used to change the state. + * + * @version 0.5 + * @author Michael Jouravlev + */ +public abstract class WizardTransition implements IWizardTransition { + + /** + * Owner wizard object, reference used to access common business fields + */ + protected IWizard wizard; + /** + * Returns owner wizard object + * @return owner wizard object + */ + public IWizard getWizard() {return wizard;} + + /** + * Human-readable name of this transition, or null if not set. + * Contrary to the state name, the transition name is optional. + */ + protected String name; + + /** + * Returns transition name + * @return transition name + */ + public String getName() {return name;} + + /** + * Source node of this edge, never null. + */ + protected IWizardStep source; + + /** + * Returns source state for this transition + * @return source state for this transition + */ + public IWizardStep getSource() {return source;} + + /** + * Sets source state for this transition; used by wizard controller + * @param value source state for this transition + */ + public void setSource(IWizardStep value) {source = value;} + + /** + * Target state for this transition, never null. + */ + protected IWizardStep target; + /** + * Returns target state of this transition + * @return target state of this transition + */ + public IWizardStep getTarget() {return target;} + + /** + * Constructs an transition. Source state will be set automatically after + * this transition is added as outgoing to a state. + * + * @param owner owner wizard object + * @param name transition name + * @param target transition target + */ + public WizardTransition(IWizard owner, String name, IWizardStep target) { + this.wizard = owner; + this.name = name; + this.target = target; + } +} Added: directory/trunks/triplesec/wicket-tools/src/main/java/wicket/examples/wizard/ezwizard/intf/IWizard.java URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/wicket-tools/src/main/java/wicket/examples/wizard/ezwizard/intf/IWizard.java?view=auto&rev=486187 ============================================================================== --- directory/trunks/triplesec/wicket-tools/src/main/java/wicket/examples/wizard/ezwizard/intf/IWizard.java (added) +++ directory/trunks/triplesec/wicket-tools/src/main/java/wicket/examples/wizard/ezwizard/intf/IWizard.java Tue Dec 12 07:23:31 2006 @@ -0,0 +1,132 @@ +/* + * 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 wicket.examples.wizard.ezwizard.intf; + +import java.util.Map; + +/** + * This interface defines an Easy Wizard controller. The wizard controller + * contains references to wizard steps and transitions, and allows to + * move from one step to another. + * + * @version 0.5 + * @author Michael Jouravlev + */ +public interface IWizard { + + /************************************************************************** + * Where are we and where did we come from + **************************************************************************/ + + /** + * Locates the initial step of this wizard. + * @return the initial step of this wizard + */ + public IWizardStep getSourceStep(); + + /** + * Locates the current step of this wizard. + * @return the current step of this wizard + */ + public IWizardStep getCurrentStep(); + + /** + * Locates a step by its name. Step name is used by clients + * of wizard controller, for example by Dialog Manager to refer + * to a corresponding view. + * @param name step name + * @return the first step found traversing forward from the initial step, + * having passed name; or null if the step not found. + */ + public IWizardStep getStepByName(String name); + + /** + * Returns a mapping name for a wizard panel. Usually wizard step name + * is used as mapping name. + * @return mapping name for a wizard view, usually path to JSP page + */ + String getCurrentStepName(); + + /** + * Returns errors for current wizard state. + * @return error messages for current wizard state + */ + Map getWizardErrors(); + + /** + * Attempts to move to the next step. If it is not possible, stays on the + * current step. + *

+ * Easy Wizard does not blindly choose a transition based on input command + * or event. Instead, it iterates over all transitions defined for current + * step, validates them, and chooses th one which is valid. If several + * transitions happen to be valid, the first one is chosen. + * @return true if was able to move to a next step, false otherwise + * @see IWizardStep#addOutgoingTransition(IWizardTransition) + */ + public boolean forward(); + + /** + * Attempts to move to the previous step. If the previous step does not + * exist or the current step is the initial step of the wizard, stays + * on the current step. Transition is not validated while traversing back. + * @return true if was able to move to a previous step, false otherwise + */ + public boolean back(); + + /** + * Returns wizard completion status. This method is redundant, + * but is defined to hide Wizard instance from WizardAction. + * @return true is wizard was successfully completed and disposed; + * false if wizard is still active or has not been initialized yet. + */ + boolean isCompleted(); + + /** + * Clean wizard errors. Just in case. Usually Wizard Manager + * cleans errors if needed. + */ + void clearWizardErrors(); + + /** + * Resets certain wizard fields, like booleans. Called with every user + * input. The primary reason for this method is older frameworks like + * Struts, which use default HTTP handling of boolean properties, and + * do not notifiy a property when it is cleared. + */ + void wizardReset(); + + /** + * Adds a listener for state change event. + */ + void addListener(IWizardListener listener); + + /** + * Removes a listener for state change event. + */ + void removeListener(IWizardListener listener); + + /** + * Removes all wizard listeners for state change event. + */ + void removeAllListeners(); + +} Added: directory/trunks/triplesec/wicket-tools/src/main/java/wicket/examples/wizard/ezwizard/intf/IWizardListener.java URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/wicket-tools/src/main/java/wicket/examples/wizard/ezwizard/intf/IWizardListener.java?view=auto&rev=486187 ============================================================================== --- directory/trunks/triplesec/wicket-tools/src/main/java/wicket/examples/wizard/ezwizard/intf/IWizardListener.java (added) +++ directory/trunks/triplesec/wicket-tools/src/main/java/wicket/examples/wizard/ezwizard/intf/IWizardListener.java Tue Dec 12 07:23:31 2006 @@ -0,0 +1,45 @@ +/* + * 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 wicket.examples.wizard.ezwizard.intf; + +/** + * Listens to state change events. Usually is called from Wizard Manager. + * + * @version 0.5 + * @author Michael Jouravlev + */ +public interface IWizardListener { + + public int STEP_REGULAR = 1; + public int STEP_LAST = 2; + + /** + * Performs action when wizard is about to change the step during + * the forward transition. + * + * @param event WizardEvent.STEP_REGULAR if about to leave "middle" step, + * WizardEvent.STEP_LAST if about to leave the final wizard + * step, effectively finishing the wizard. + * @return true if it is ok to move to the next step, false if step + * cannot be changed. + */ + boolean onTransition(int event); +} Added: directory/trunks/triplesec/wicket-tools/src/main/java/wicket/examples/wizard/ezwizard/intf/IWizardStep.java URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/wicket-tools/src/main/java/wicket/examples/wizard/ezwizard/intf/IWizardStep.java?view=auto&rev=486187 ============================================================================== --- directory/trunks/triplesec/wicket-tools/src/main/java/wicket/examples/wizard/ezwizard/intf/IWizardStep.java (added) +++ directory/trunks/triplesec/wicket-tools/src/main/java/wicket/examples/wizard/ezwizard/intf/IWizardStep.java Tue Dec 12 07:23:31 2006 @@ -0,0 +1,128 @@ +/* + * 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 wicket.examples.wizard.ezwizard.intf; + +/** + * Represents a state of a wizard Finite State Machine (FSM). + *

+ * A base state contains common navigation methods, a concrete state also + * contains setters/getters for domain data, relevant to this state. + * + * @version 0.5 + * @author Michael Jouravlev + */ +public interface IWizardStep { + + /** + * Returns array of outgoing transitions for this state. The transitions + * are weighed according to the order in which they were added to this + * state. + * + * @return array of outgoing transitions + */ + IWizardTransition[] getOutgoingTransitions(); + + /** + * Selects a transition which will be used to move forward from + * from this state. + *

+ * All outgoing transitions are validated in the order of their weight. + * The first valid transition is chosen. + * + * @return a valid outgoing edge or null if no valid edges found + */ + IWizardTransition getOutgoingTransition(); + + /** + * Returns the incoming transition, was used to get to this state. + * + * @return incoming transition + */ + IWizardTransition getIncomingTransition(); + + /** + * Sets the incoming transition. Used during forward traversal + * to mark the way through the wizard. The incoming transition + * is used for backward traversal. + * + * @param value incoming transition + */ + void setIncomingTransition(IWizardTransition value); + + /** + * Adds an outgoing transition. Order in which transitions are added + * to a state, defines their weight (or rank). Transition added to + * a state first, has the highest weight. Transitions are validated + * during forward traversal in order of their weight, and the first + * valid transition is chosen for state change. + * + * @param value outgoing transition + */ + void addOutgoingTransition(IWizardTransition value); + + /** + * Returns true if this state has been marked as checkpoint. This means + * that a wizard cannot return back from this state. + * + * @return true if this state is a checkpoint + */ + boolean isCheckpoint(); + + /** + * Returns the name of this state. Each state must have a unique name.. + * + * @return state name + */ + String getStateName(); + + /** + * Returns the wizard, which contains this state as part + * of the wizard sequence. + * + * @return wizard which owns this node + */ + IWizard getWizard(); + + /** + * Verifies that this state is included in the path to the current state. + * + * @return true if this state is present in the actual path to the current + * state, but is not a current state itself; false otherwise. + */ + boolean isStateInPath(); + + /** + * Instructs the state to clear all its boolean properties. + * Usually called before the properties are about to be set. + *

+ * The reason for this method is that browsers/HTTP do not notify + * server about cleared checkboxes or radiobuttons. So, these values + * should be cleared before they are set with client values. + *

+ * This method is not used in JSF. + */ + void resetBooleans(); + + /** + * Sets master wizard controller for this step. + */ + void setOwner(IWizard wizard); +} Added: directory/trunks/triplesec/wicket-tools/src/main/java/wicket/examples/wizard/ezwizard/intf/IWizardTransition.java URL: http://svn.apache.org/viewvc/directory/trunks/triplesec/wicket-tools/src/main/java/wicket/examples/wizard/ezwizard/intf/IWizardTransition.java?view=auto&rev=486187 ============================================================================== --- directory/trunks/triplesec/wicket-tools/src/main/java/wicket/examples/wizard/ezwizard/intf/IWizardTransition.java (added) +++ directory/trunks/triplesec/wicket-tools/src/main/java/wicket/examples/wizard/ezwizard/intf/IWizardTransition.java Tue Dec 12 07:23:31 2006 @@ -0,0 +1,86 @@ +/* + * 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 wicket.examples.wizard.ezwizard.intf; + +/** + * Represents a state transition. In Easy Wizard a transition is an object, it + * can refer to its source and target states, and can validate itself. When + * wizard controller moves from one state to another, it iterates through + * transitions of current state, and validates each of them in order of their + * weight. The first valid transition is used to change the state. + * + * @version 0.5 + * @author Michael Jouravlev + */ +public interface IWizardTransition { + + /** + * Returns human-readable name of the transition, or null if not set. + *

+ * The name is not needed for wizard navigation and thus is optional. + * Nevertheless, names are highly recommended because they allow to + * find a transition by name, and also may provide mapping name + * for UI layer. + * + * @return transition name or null if name is not set + */ + public String getName(); + + /** + * Returns source of this state, cannot be null. Each transition refers + * to its source and target states. + * + * @return source of this transition + */ + public IWizardStep getSource(); + + /** + * Sets source state for this transition + * @param value source state for this transition + */ + public void setSource(IWizardStep value); + + /** + * Returns target state of this transition, cannot be null. Each transition + * refers to its source and target states. + * + * @return target state of this transition + */ + public IWizardStep getTarget(); + + /** + * Validates this transition. Usually checks the domain accounts, which + * is referenced from the source state of this transition. + *

+ * Outgoing transitions are validated in order of their weight, + * when state is about to change. The first valid transition is chosen + * for traversal. + * + * @return true if this transition is valid + */ + public boolean validate(); + + /** + * Returns wizard controller object, which owns this state + * @return wizard which owns this state + */ + IWizard getWizard(); +}