Source Code Cross Referenced for PolicyUtil.java in  » 6.0-JDK-Modules-com.sun » wsit » com » sun » xml » ws » security » impl » policy » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules com.sun » wsit » com.sun.xml.ws.security.impl.policy 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
0003:         * 
0004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
0005:         * 
0006:         * The contents of this file are subject to the terms of either the GNU
0007:         * General Public License Version 2 only ("GPL") or the Common Development
0008:         * and Distribution License("CDDL") (collectively, the "License").  You
0009:         * may not use this file except in compliance with the License. You can obtain
0010:         * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
0011:         * or glassfish/bootstrap/legal/LICENSE.txt.  See the License for the specific
0012:         * language governing permissions and limitations under the License.
0013:         * 
0014:         * When distributing the software, include this License Header Notice in each
0015:         * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
0016:         * Sun designates this particular file as subject to the "Classpath" exception
0017:         * as provided by Sun in the GPL Version 2 section of the License file that
0018:         * accompanied this code.  If applicable, add the following below the License
0019:         * Header, with the fields enclosed by brackets [] replaced by your own
0020:         * identifying information: "Portions Copyrighted [year]
0021:         * [name of copyright owner]"
0022:         * 
0023:         * Contributor(s):
0024:         * 
0025:         * If you wish your version of this file to be governed by only the CDDL or
0026:         * only the GPL Version 2, indicate your decision by adding "[Contributor]
0027:         * elects to include this software in this distribution under the [CDDL or GPL
0028:         * Version 2] license."  If you don't indicate a single choice of license, a
0029:         * recipient has the option to distribute your version of this file under
0030:         * either the CDDL, the GPL Version 2 or to extend the choice of license to
0031:         * its licensees as provided above.  However, if you add GPL Version 2 code
0032:         * and therefore, elected the GPL Version 2 license, then the option applies
0033:         * only if the new code is made subject to such option by the copyright
0034:         * holder.
0035:         */
0036:
0037:        package com.sun.xml.ws.security.impl.policy;
0038:
0039:        import com.sun.xml.ws.api.addressing.AddressingVersion;
0040:        import com.sun.xml.ws.policy.PolicyAssertion;
0041:        import com.sun.xml.ws.security.policy.AlgorithmSuiteValue;
0042:        import static com.sun.xml.ws.security.impl.policy.Constants.*;
0043:        import javax.xml.namespace.QName;
0044:
0045:        /**
0046:         *
0047:         * @author K.Venugopal@sun.com Abhijit.Das@Sun.COM
0048:         */
0049:        public class PolicyUtil {
0050:
0051:            /** Creates a new instance of PolicyUtil */
0052:            public PolicyUtil() {
0053:            }
0054:
0055:            public static boolean isSecurityPolicyNS(PolicyAssertion pa) {
0056:                if (Constants.SECURITY_POLICY_NS.equals(pa.getName()
0057:                        .getNamespaceURI())) {
0058:                    return true;
0059:                }
0060:                return false;
0061:            }
0062:
0063:            public static boolean isSunPolicyNS(PolicyAssertion pa) {
0064:                if (Constants.SUN_WSS_SECURITY_SERVER_POLICY_NS.equals(pa
0065:                        .getName().getNamespaceURI())
0066:                        || Constants.SUN_WSS_SECURITY_CLIENT_POLICY_NS
0067:                                .equals(pa.getName().getNamespaceURI())) {
0068:                    return true;
0069:                }
0070:                return false;
0071:            }
0072:
0073:            public static boolean isAddressingNS(PolicyAssertion pa) {
0074:                if (AddressingVersion.MEMBER.getNsUri().equals(
0075:                        pa.getName().getNamespaceURI())) {
0076:                    return true;
0077:                }
0078:                if (AddressingVersion.W3C.getNsUri().equals(
0079:                        pa.getName().getNamespaceURI())) {
0080:                    return true;
0081:                }
0082:                return false;
0083:            }
0084:
0085:            public static boolean isTrustNS(PolicyAssertion pa) {
0086:                if (Constants.TRUST_NS.equals(pa.getName().getNamespaceURI())) {
0087:                    return true;
0088:                }
0089:                return false;
0090:            }
0091:
0092:            public static boolean isUtilityNS(PolicyAssertion pa) {
0093:                if (Constants.UTILITY_NS.equals(pa.getName().getNamespaceURI())) {
0094:                    return true;
0095:                }
0096:                return false;
0097:            }
0098:
0099:            public static boolean isXpathNS(PolicyAssertion pa) {
0100:                if (Constants.XPATH_NS.equals(pa.getName().getNamespaceURI())) {
0101:                    return true;
0102:                }
0103:                return false;
0104:            }
0105:
0106:            public static boolean isAlgorithmAssertion(PolicyAssertion pa) {
0107:                if (isSecurityPolicyNS(pa)) {
0108:                    if (pa.getName().getLocalPart().equals(AlgorithmSuite)) {
0109:                        return true;
0110:                    }
0111:                }
0112:                return false;
0113:            }
0114:
0115:            public static boolean isToken(PolicyAssertion pa) {
0116:                if (!isSecurityPolicyNS(pa)) {
0117:                    return false;
0118:                }
0119:
0120:                if (pa.getName().getLocalPart().equals(EncryptionToken)) {
0121:                    return true;
0122:                } else if (pa.getName().getLocalPart().equals(SignatureToken)) {
0123:                    return true;
0124:                } else if (pa.getName().getLocalPart().equals(InitiatorToken)) {
0125:                    return true;
0126:                } else if (pa.getName().getLocalPart().equals(HttpsToken)) {
0127:                    return true;
0128:                } else if (pa.getName().getLocalPart().equals(IssuedToken)) {
0129:                    return true;
0130:                } else if (pa.getName().getLocalPart().equals(KerberosToken)) {
0131:                    return true;
0132:                } else if (pa.getName().getLocalPart().equals(ProtectionToken)) {
0133:                    return true;
0134:                } else if (pa.getName().getLocalPart().equals(RecipientToken)) {
0135:                    return true;
0136:                } else if (pa.getName().getLocalPart().equals(SupportingTokens)) {
0137:                    return true;
0138:                } else if (pa.getName().getLocalPart().equals(
0139:                        SC10SecurityContextToken)) {
0140:                    return true;
0141:                } else if (pa.getName().getLocalPart().equals(SamlToken)) {
0142:                    return true;
0143:                } else if (pa.getName().getLocalPart().equals(UsernameToken)) {
0144:                    return true;
0145:                } else if (pa.getName().getLocalPart().equals(X509Token)) {
0146:                    return true;
0147:                } else if (pa.getName().getLocalPart().equals(
0148:                        SecureConversationToken)) {
0149:                    return true;
0150:                } else if (pa.getName().getLocalPart().equals(TransportToken)) {
0151:                    return true;
0152:                }
0153:                return false;
0154:            }
0155:
0156:            public static boolean isBootstrapPolicy(PolicyAssertion assertion) {
0157:                if (!isSecurityPolicyNS(assertion)) {
0158:                    return false;
0159:                }
0160:
0161:                if (assertion.getName().getLocalPart().equals(BootstrapPolicy)) {
0162:                    return true;
0163:                }
0164:                return false;
0165:            }
0166:
0167:            public static boolean isTarget(PolicyAssertion assertion) {
0168:                if (!isSecurityPolicyNS(assertion)) {
0169:                    return false;
0170:                }
0171:
0172:                String name = assertion.getName().getLocalPart();
0173:                if (name.equals(EncryptedParts) || name.equals(SignedParts)
0174:                        || name.equals(SignedElements)
0175:                        || name.equals(EncryptedElements)) {
0176:                    return true;
0177:                }
0178:                return false;
0179:            }
0180:
0181:            public static boolean isXPath(PolicyAssertion assertion) {
0182:                if (!isSecurityPolicyNS(assertion)) {
0183:                    return false;
0184:                }
0185:
0186:                if (assertion.getName().getLocalPart().equals(XPath)) {
0187:                    return true;
0188:                }
0189:                return false;
0190:            }
0191:
0192:            public static boolean isXPathFilter20(PolicyAssertion assertion) {
0193:                if (!isXpathNS(assertion)) {
0194:                    return false;
0195:                }
0196:
0197:                if (assertion.getName().getLocalPart().equals(XPathFilter20)) {
0198:                    return true;
0199:                }
0200:                return false;
0201:            }
0202:
0203:            public static boolean isRequiredKey(PolicyAssertion assertion) {
0204:                return false;
0205:            }
0206:
0207:            public static boolean isTokenType(PolicyAssertion assertion) {
0208:
0209:                if (!isSecurityPolicyNS(assertion)) {
0210:                    return false;
0211:                }
0212:
0213:                if (assertion.getName().getLocalPart().equals(WssX509V1Token10)) {
0214:                    return true;
0215:                } else if (assertion.getName().getLocalPart().equals(
0216:                        WssX509V3Token10)) {
0217:                    return true;
0218:                } else if (assertion.getName().getLocalPart().equals(
0219:                        WssX509Pkcs7Token10)) {
0220:                    return true;
0221:                } else if (assertion.getName().getLocalPart().equals(
0222:                        WssX509PkiPathV1Token10)) {
0223:                    return true;
0224:                } else if (assertion.getName().getLocalPart().equals(
0225:                        WssX509V1Token11)) {
0226:                    return true;
0227:                } else if (assertion.getName().getLocalPart().equals(
0228:                        WssX509V3Token11)) {
0229:                    return true;
0230:                } else if (assertion.getName().getLocalPart().equals(
0231:                        WssX509Pkcs7Token11)) {
0232:                    return true;
0233:                } else if (assertion.getName().getLocalPart().equals(
0234:                        WssX509PkiPathV1Token11)) {
0235:                    return true;
0236:                }
0237:                return false;
0238:            }
0239:
0240:            public static boolean isTokenReferenceType(PolicyAssertion assertion) {
0241:
0242:                if (!isSecurityPolicyNS(assertion)) {
0243:                    return false;
0244:                }
0245:
0246:                if (assertion.getName().getLocalPart().equals(
0247:                        RequireKeyIdentifierReference)) {
0248:                    return true;
0249:                } else if (assertion.getName().getLocalPart().equals(
0250:                        RequireThumbprintReference)) {
0251:                    return true;
0252:                } else if (assertion.getName().getLocalPart().equals(
0253:                        RequireEmbeddedTokenReference)) {
0254:                    return true;
0255:                } else if (assertion.getName().getLocalPart().equals(
0256:                        RequireIssuerSerialReference)) {
0257:                    return true;
0258:                }
0259:                return false;
0260:            }
0261:
0262:            public static boolean isUsernameTokenType(PolicyAssertion assertion) {
0263:                if (!isSecurityPolicyNS(assertion)) {
0264:                    return false;
0265:                }
0266:
0267:                if (assertion.getName().getLocalPart().equals(
0268:                        WssUsernameToken10)
0269:                        || assertion.getName().getLocalPart().equals(
0270:                                WssUsernameToken11)) {
0271:                    return true;
0272:                }
0273:                return false;
0274:            }
0275:
0276:            public static boolean isHttpsToken(PolicyAssertion assertion) {
0277:                if (!isSecurityPolicyNS(assertion)) {
0278:                    return false;
0279:                }
0280:
0281:                if (assertion.getName().getLocalPart().equals(
0282:                        Constants.HttpsToken)) {
0283:                    return true;
0284:                }
0285:                return false;
0286:            }
0287:
0288:            public static boolean isSecurityContextToken(PolicyAssertion token) {
0289:                if (!isSecurityPolicyNS(token)) {
0290:                    return false;
0291:                }
0292:
0293:                if (token.getName().getLocalPart().equals(
0294:                        Constants.SecurityContextToken)) {
0295:                    return true;
0296:                }
0297:                return false;
0298:            }
0299:
0300:            public static boolean isSecurityContextTokenType(
0301:                    PolicyAssertion token) {
0302:                if (!isSecurityPolicyNS(token)) {
0303:                    return false;
0304:                }
0305:                String localPart = token.getName().getLocalPart();
0306:                if (localPart.equals(SC10SecurityContextToken)) {
0307:                    return true;
0308:                }
0309:                return false;
0310:            }
0311:
0312:            public static boolean isKerberosToken(PolicyAssertion token) {
0313:                if (!isSecurityPolicyNS(token)) {
0314:                    return false;
0315:                }
0316:
0317:                if (token.getName().getLocalPart().equals(
0318:                        Constants.KerberosToken)) {
0319:                    return true;
0320:                }
0321:                return false;
0322:            }
0323:
0324:            public static boolean isKerberosTokenType(PolicyAssertion token) {
0325:                if (!isSecurityPolicyNS(token)) {
0326:                    return false;
0327:                }
0328:                String localPart = token.getName().getLocalPart();
0329:                if (localPart.equals(WssKerberosV5ApReqToken11)) {
0330:                    return true;
0331:                } else if (localPart.equals(WssGssKerberosV5ApReqToken11)) {
0332:                    return true;
0333:                }
0334:                return false;
0335:            }
0336:
0337:            public static boolean isRelToken(PolicyAssertion token) {
0338:                if (!isSecurityPolicyNS(token)) {
0339:                    return false;
0340:                }
0341:
0342:                if (token.getName().getLocalPart().equals(Constants.RelToken)) {
0343:                    return true;
0344:                }
0345:                return false;
0346:            }
0347:
0348:            public static boolean isRelTokenType(PolicyAssertion token) {
0349:                if (!isSecurityPolicyNS(token)) {
0350:                    return false;
0351:                }
0352:                String localPart = token.getName().getLocalPart();
0353:                if (localPart.equals(WssRelV10Token10)) {
0354:                    return true;
0355:                } else if (localPart.equals(WssRelV10Token11)) {
0356:                    return true;
0357:                } else if (localPart.equals(WssRelV20Token10)) {
0358:                    return true;
0359:                } else if (localPart.equals(WssRelV20Token11)) {
0360:                    return true;
0361:                }
0362:                return false;
0363:            }
0364:
0365:            public static boolean isIncludeTimestamp(PolicyAssertion assertion) {
0366:                if (!isSecurityPolicyNS(assertion)) {
0367:                    return false;
0368:                }
0369:
0370:                if (assertion.getName().getLocalPart().equals(IncludeTimestamp)) {
0371:                    return true;
0372:                }
0373:                return false;
0374:            }
0375:
0376:            public static boolean disableTimestampSigning(
0377:                    PolicyAssertion assertion) {
0378:                if (!isSunPolicyNS(assertion)) {
0379:                    return false;
0380:                }
0381:
0382:                if (assertion.getName().getLocalPart().equals(
0383:                        DisableTimestampSigning)) {
0384:                    return true;
0385:                }
0386:                return false;
0387:            }
0388:
0389:            public static boolean isEncryptBeforeSign(PolicyAssertion assertion) {
0390:                if (!isSecurityPolicyNS(assertion)) {
0391:                    return false;
0392:                }
0393:
0394:                if (assertion.getName().getLocalPart().equals(
0395:                        EncryptBeforeSigning)) {
0396:                    return true;
0397:                }
0398:                return false;
0399:            }
0400:
0401:            public static boolean isSignBeforeEncrypt(PolicyAssertion assertion) {
0402:                if (!isSecurityPolicyNS(assertion)) {
0403:                    return false;
0404:                }
0405:
0406:                if (assertion.getName().getLocalPart().equals(
0407:                        SignBeforeEncrypting)) {
0408:                    return true;
0409:                }
0410:                return false;
0411:            }
0412:
0413:            public static boolean isContentOnlyAssertion(
0414:                    PolicyAssertion assertion) {
0415:                if (!isSecurityPolicyNS(assertion)) {
0416:                    return false;
0417:                }
0418:
0419:                if (assertion.getName().getLocalPart().equals(
0420:                        OnlySignEntireHeadersAndBody)) {
0421:                    return true;
0422:                }
0423:                return false;
0424:            }
0425:
0426:            public static boolean isMessageLayout(PolicyAssertion assertion) {
0427:                if (!isSecurityPolicyNS(assertion)) {
0428:                    return false;
0429:                }
0430:
0431:                if (assertion.getName().getLocalPart().equals(Layout)) {
0432:                    return true;
0433:                }
0434:                return false;
0435:            }
0436:
0437:            public static boolean isEncryptParts(PolicyAssertion assertion) {
0438:                if (!isSecurityPolicyNS(assertion)) {
0439:                    return false;
0440:                }
0441:
0442:                if (assertion.getName().getLocalPart().equals(EncryptedParts)) {
0443:                    return true;
0444:                }
0445:                return false;
0446:            }
0447:
0448:            public static boolean isEncryptedElements(PolicyAssertion assertion) {
0449:                if (!isSecurityPolicyNS(assertion)) {
0450:                    return false;
0451:                }
0452:
0453:                if (assertion.getName().getLocalPart()
0454:                        .equals(EncryptedElements)) {
0455:                    return true;
0456:                }
0457:                return false;
0458:            }
0459:
0460:            public static boolean isSignedParts(PolicyAssertion assertion) {
0461:                if (!isSecurityPolicyNS(assertion)) {
0462:                    return false;
0463:                }
0464:
0465:                if (assertion.getName().getLocalPart().equals(SignedParts)) {
0466:                    return true;
0467:                }
0468:                return false;
0469:            }
0470:
0471:            public static boolean isSignedElements(PolicyAssertion assertion) {
0472:                if (!isSecurityPolicyNS(assertion)) {
0473:                    return false;
0474:                }
0475:
0476:                if (assertion.getName().getLocalPart().equals(SignedElements)) {
0477:                    return true;
0478:                }
0479:                return false;
0480:            }
0481:
0482:            public static boolean isSignedSupportingToken(
0483:                    PolicyAssertion policyAssertion) {
0484:                if (!isSecurityPolicyNS(policyAssertion)) {
0485:                    return false;
0486:                }
0487:
0488:                if (policyAssertion.getName().getLocalPart().equals(
0489:                        SignedSupportingTokens)) {
0490:                    return true;
0491:                }
0492:                return false;
0493:            }
0494:
0495:            public static boolean isEndorsedSupportingToken(
0496:                    PolicyAssertion policyAssertion) {
0497:                if (!isSecurityPolicyNS(policyAssertion)) {
0498:                    return false;
0499:                }
0500:
0501:                if (policyAssertion.getName().getLocalPart().equals(
0502:                        EndorsingSupportingTokens)) {
0503:                    return true;
0504:                }
0505:                return false;
0506:            }
0507:
0508:            public static boolean isSignedEndorsingSupportingToken(
0509:                    PolicyAssertion policyAssertion) {
0510:                if (!isSecurityPolicyNS(policyAssertion)) {
0511:                    return false;
0512:                }
0513:
0514:                if (policyAssertion.getName().getLocalPart().equals(
0515:                        SignedEndorsingSupportingTokens)) {
0516:                    return true;
0517:                }
0518:                return false;
0519:            }
0520:
0521:            public static boolean isBinding(PolicyAssertion policyAssertion) {
0522:
0523:                if (!isSecurityPolicyNS(policyAssertion)) {
0524:                    return false;
0525:                }
0526:
0527:                String name = policyAssertion.getName().getLocalPart();
0528:                if (name.equals(SymmetricBinding)
0529:                        || name.equals(AsymmetricBinding)
0530:                        || name.equals(TransportBinding)) {
0531:
0532:                    return true;
0533:                }
0534:                return false;
0535:            }
0536:
0537:            public static boolean isUsernameToken(PolicyAssertion token) {
0538:                if (!isSecurityPolicyNS(token)) {
0539:                    return false;
0540:                }
0541:
0542:                if (token.getName().getLocalPart().equals(UsernameToken)) {
0543:                    return true;
0544:                }
0545:                return false;
0546:            }
0547:
0548:            public static boolean isSamlToken(PolicyAssertion token) {
0549:                if (!isSecurityPolicyNS(token)) {
0550:                    return false;
0551:                }
0552:
0553:                if (token.getName().getLocalPart().equals(SamlToken)) {
0554:                    return true;
0555:                }
0556:                return false;
0557:            }
0558:
0559:            public static boolean isSamlTokenType(PolicyAssertion token) {
0560:                if (!isSecurityPolicyNS(token)) {
0561:                    return false;
0562:                }
0563:                String localPart = token.getName().getLocalPart();
0564:                if (localPart.equals(WssSamlV10Token10)) {
0565:                    return true;
0566:                } else if (localPart.equals(WssSamlV10Token11)) {
0567:                    return true;
0568:                } else if (localPart.equals(WssSamlV11Token10)) {
0569:                    return true;
0570:                } else if (localPart.equals(WssSamlV20Token11)) {
0571:                    return true;
0572:                } else if (localPart.equals(WssSamlV11Token11)) {
0573:                    return true;
0574:                }
0575:                return false;
0576:            }
0577:
0578:            public static boolean isIssuedToken(PolicyAssertion token) {
0579:                if (!isSecurityPolicyNS(token)) {
0580:                    return false;
0581:                }
0582:
0583:                if (token.getName().getLocalPart().equals(IssuedToken)) {
0584:                    return true;
0585:                }
0586:                return false;
0587:            }
0588:
0589:            public static boolean isSecureConversationToken(
0590:                    PolicyAssertion token) {
0591:                if (!isSecurityPolicyNS(token)) {
0592:                    return false;
0593:                }
0594:
0595:                if (token.getName().getLocalPart().equals(
0596:                        SecureConversationToken)) {
0597:                    return true;
0598:                }
0599:                return false;
0600:            }
0601:
0602:            public static boolean isX509Token(PolicyAssertion policyAssertion) {
0603:                if (!isSecurityPolicyNS(policyAssertion)) {
0604:                    return false;
0605:                }
0606:
0607:                if (policyAssertion.getName().getLocalPart().equals(X509Token)) {
0608:                    return true;
0609:                }
0610:                return false;
0611:            }
0612:
0613:            public static boolean isAsymmetricBinding(PolicyAssertion assertion) {
0614:                if (!isSecurityPolicyNS(assertion)) {
0615:                    return false;
0616:                }
0617:
0618:                if (assertion.getName().getLocalPart()
0619:                        .equals(AsymmetricBinding)) {
0620:                    return true;
0621:                }
0622:                return false;
0623:            }
0624:
0625:            public static boolean isAsymmetricBinding(QName assertion) {
0626:                if (assertion.getLocalPart()
0627:                        .equals(Constants.AsymmetricBinding)
0628:                        && assertion.getNamespaceURI().equals(
0629:                                Constants.SECURITY_POLICY_NS)) {
0630:                    return true;
0631:                }
0632:                return false;
0633:            }
0634:
0635:            public static boolean isTransportBinding(PolicyAssertion assertion) {
0636:                if (!isSecurityPolicyNS(assertion)) {
0637:                    return false;
0638:                }
0639:
0640:                if (assertion.getName().getLocalPart().equals(TransportBinding)) {
0641:                    return true;
0642:                }
0643:                return false;
0644:            }
0645:
0646:            public static boolean isTransportBinding(QName assertion) {
0647:                if (assertion.getLocalPart().equals(Constants.TransportBinding)
0648:                        && assertion.getNamespaceURI().equals(
0649:                                Constants.SECURITY_POLICY_NS)) {
0650:                    return true;
0651:                }
0652:                return false;
0653:            }
0654:
0655:            public static boolean isSymmetricBinding(PolicyAssertion assertion) {
0656:                if (!isSecurityPolicyNS(assertion)) {
0657:                    return false;
0658:                }
0659:
0660:                if (assertion.getName().getLocalPart().equals(SymmetricBinding)) {
0661:                    return true;
0662:                }
0663:                return false;
0664:            }
0665:
0666:            public static boolean isSymmetricBinding(QName assertion) {
0667:                if (assertion.getLocalPart().equals(Constants.SymmetricBinding)
0668:                        && assertion.getNamespaceURI().equals(
0669:                                Constants.SECURITY_POLICY_NS)) {
0670:                    return true;
0671:                }
0672:                return false;
0673:            }
0674:
0675:            public static boolean isSupportingTokens(PolicyAssertion assertion) {
0676:                if (!isSecurityPolicyNS(assertion)) {
0677:                    return false;
0678:                }
0679:
0680:                if (isSignedSupportingToken(assertion)
0681:                        || isEndorsedSupportingToken(assertion)
0682:                        || isSignedEndorsingSupportingToken(assertion)
0683:                        || isSupportingToken(assertion)) {
0684:                    return true;
0685:                }
0686:                return false;
0687:            }
0688:
0689:            public static boolean isSupportingToken(PolicyAssertion assertion) {
0690:                if (!isSecurityPolicyNS(assertion)) {
0691:                    return false;
0692:                }
0693:
0694:                if (assertion.getName().getLocalPart().equals(SupportingTokens)) {
0695:                    return true;
0696:                }
0697:                return false;
0698:            }
0699:
0700:            public static boolean isSupportClientChallenge(
0701:                    PolicyAssertion assertion) {
0702:                if (!isSecurityPolicyNS(assertion)) {
0703:                    return false;
0704:                }
0705:
0706:                if (assertion.getName().getLocalPart().equals(
0707:                        MustSupportClientChallenge)) {
0708:                    return true;
0709:                }
0710:                return false;
0711:            }
0712:
0713:            public static boolean isSupportServerChallenge(
0714:                    PolicyAssertion assertion) {
0715:                if (!isSecurityPolicyNS(assertion)) {
0716:                    return false;
0717:                }
0718:
0719:                if (assertion.getName().getLocalPart().equals(
0720:                        MustSupportServerChallenge)) {
0721:                    return true;
0722:                }
0723:                return false;
0724:            }
0725:
0726:            public static boolean isWSS10PolicyContent(PolicyAssertion assertion) {
0727:                if (!isSecurityPolicyNS(assertion)) {
0728:                    return false;
0729:                }
0730:
0731:                if (assertion.getName().getLocalPart().equals(
0732:                        MustSupportRefKeyIdentifier)) {
0733:                    return true;
0734:                } else if (assertion.getName().getLocalPart().equals(
0735:                        MustSupportRefIssuerSerial)) {
0736:                    return true;
0737:                } else if (assertion.getName().getLocalPart().equals(
0738:                        RequireExternalUriReference)) {
0739:                    return true;
0740:                } else if (assertion.getName().getLocalPart().equals(
0741:                        RequireEmbeddedTokenReference)) {
0742:                    return true;
0743:                }
0744:                return false;
0745:            }
0746:
0747:            public static boolean isWSS11PolicyContent(PolicyAssertion assertion) {
0748:                if (!isSecurityPolicyNS(assertion)) {
0749:                    return false;
0750:                }
0751:
0752:                if (assertion.getName().getLocalPart().equals(
0753:                        MustSupportRefKeyIdentifier)) {
0754:                    return true;
0755:                } else if (assertion.getName().getLocalPart().equals(
0756:                        MustSupportRefIssuerSerial)) {
0757:                    return true;
0758:                } else if (assertion.getName().getLocalPart().equals(
0759:                        MustSupportRefThumbprint)) {
0760:                    return true;
0761:                } else if (assertion.getName().getLocalPart().equals(
0762:                        MustSupportRefEncryptedKey)) {
0763:                    return true;
0764:                } else if (assertion.getName().getLocalPart().equals(
0765:                        RequireSignatureConfirmation)) {
0766:                    return true;
0767:                } else if (assertion.getName().getLocalPart().equals(
0768:                        RequireExternalUriReference)) {
0769:                    return true;
0770:                } else if (assertion.getName().getLocalPart().equals(
0771:                        RequireEmbeddedTokenReference)) {
0772:                    return true;
0773:                }
0774:                return false;
0775:            }
0776:
0777:            public static boolean isRequireClientEntropy(
0778:                    PolicyAssertion assertion) {
0779:                if (!isSecurityPolicyNS(assertion)) {
0780:                    return false;
0781:                }
0782:
0783:                if (assertion.getName().getLocalPart().equals(
0784:                        RequireClientEntropy)) {
0785:                    return true;
0786:                }
0787:                return false;
0788:            }
0789:
0790:            public static boolean isRequireServerEntropy(
0791:                    PolicyAssertion assertion) {
0792:                if (!isSecurityPolicyNS(assertion)) {
0793:                    return false;
0794:                }
0795:
0796:                if (assertion.getName().getLocalPart().equals(
0797:                        RequireServerEntropy)) {
0798:                    return true;
0799:                }
0800:                return false;
0801:            }
0802:
0803:            public static boolean isSupportIssuedTokens(
0804:                    PolicyAssertion assertion) {
0805:                if (!isSecurityPolicyNS(assertion)) {
0806:                    return false;
0807:                }
0808:
0809:                if (assertion.getName().getLocalPart().equals(
0810:                        MustSupportIssuedTokens)) {
0811:                    return true;
0812:                }
0813:                return false;
0814:            }
0815:
0816:            public static boolean isIssuer(PolicyAssertion assertion) {
0817:                if (!isSecurityPolicyNS(assertion)) {
0818:                    return false;
0819:                }
0820:
0821:                if (assertion.getName().getLocalPart().equals(Issuer)) {
0822:                    return true;
0823:                }
0824:                return false;
0825:            }
0826:
0827:            public static boolean isWSS10(PolicyAssertion assertion) {
0828:                if (!isSecurityPolicyNS(assertion)) {
0829:                    return false;
0830:                }
0831:                if (assertion.getName().getLocalPart().equals(Wss10)) {
0832:                    return true;
0833:                }
0834:                return false;
0835:            }
0836:
0837:            public static boolean isWSS11(PolicyAssertion assertion) {
0838:                if (!isSecurityPolicyNS(assertion)) {
0839:                    return false;
0840:                }
0841:
0842:                if (assertion.getName().getLocalPart().equals(Wss11)) {
0843:                    return true;
0844:                }
0845:                return false;
0846:            }
0847:
0848:            public static boolean isTrust10(PolicyAssertion assertion) {
0849:                if (!isSecurityPolicyNS(assertion)) {
0850:                    return false;
0851:                }
0852:
0853:                if (assertion.getName().getLocalPart().equals(Trust10)) {
0854:                    return true;
0855:                }
0856:                return false;
0857:            }
0858:
0859:            public static boolean isBody(PolicyAssertion assertion) {
0860:                if (!isSecurityPolicyNS(assertion)) {
0861:                    return false;
0862:                }
0863:
0864:                if (assertion.getName().getLocalPart().equals(Constants.Body)) {
0865:                    return true;
0866:                }
0867:                return false;
0868:            }
0869:
0870:            public static boolean isRequireDerivedKeys(PolicyAssertion assertion) {
0871:                if (!isSecurityPolicyNS(assertion)) {
0872:                    return false;
0873:                }
0874:
0875:                if (RequireDerivedKeys.toString().equals(
0876:                        assertion.getName().getLocalPart().toString())) {
0877:                    return true;
0878:                }
0879:                return false;
0880:            }
0881:
0882:            public static AlgorithmSuiteValue isValidAlgorithmSuiteValue(
0883:                    PolicyAssertion assertion) {
0884:                if (!isSecurityPolicyNS(assertion)) {
0885:                    return null;
0886:                }
0887:
0888:                if (assertion.getName().getLocalPart().equals(Basic256)) {
0889:                    return AlgorithmSuiteValue.Basic256;
0890:                } else if (assertion.getName().getLocalPart().equals(Basic192)) {
0891:                    return AlgorithmSuiteValue.Basic192;
0892:                } else if (assertion.getName().getLocalPart().equals(Basic128)) {
0893:                    return AlgorithmSuiteValue.Basic128;
0894:                } else if (assertion.getName().getLocalPart().equals(TripleDes)) {
0895:                    return AlgorithmSuiteValue.TripleDes;
0896:                } else if (assertion.getName().getLocalPart().equals(
0897:                        Basic256Rsa15)) {
0898:                    return AlgorithmSuiteValue.Basic256Rsa15;
0899:                } else if (assertion.getName().getLocalPart().equals(
0900:                        Basic192Rsa15)) {
0901:                    return AlgorithmSuiteValue.Basic192Rsa15;
0902:                } else if (assertion.getName().getLocalPart().equals(
0903:                        Basic128Rsa15)) {
0904:                    return AlgorithmSuiteValue.Basic128Rsa15;
0905:                } else if (assertion.getName().getLocalPart().equals(
0906:                        TripleDesRsa15)) {
0907:                    return AlgorithmSuiteValue.TripleDesRsa15;
0908:                } else if (assertion.getName().getLocalPart().equals(
0909:                        Basic256Sha256)) {
0910:                    return AlgorithmSuiteValue.Basic256Sha256;
0911:                } else if (assertion.getName().getLocalPart().equals(
0912:                        Basic192Sha256)) {
0913:                    return AlgorithmSuiteValue.Basic192Sha256;
0914:                } else if (assertion.getName().getLocalPart().equals(
0915:                        Basic128Sha256)) {
0916:                    return AlgorithmSuiteValue.Basic128Sha256;
0917:                } else if (assertion.getName().getLocalPart().equals(
0918:                        TripleDesSha256)) {
0919:                    return AlgorithmSuiteValue.TripleDesSha256;
0920:                } else if (assertion.getName().getLocalPart().equals(
0921:                        Basic256Sha256Rsa15)) {
0922:                    return AlgorithmSuiteValue.Basic256Sha256Rsa15;
0923:                } else if (assertion.getName().getLocalPart().equals(
0924:                        Basic192Sha256Rsa15)) {
0925:                    return AlgorithmSuiteValue.Basic192Sha256Rsa15;
0926:                } else if (assertion.getName().getLocalPart().equals(
0927:                        Basic128Sha256Rsa15)) {
0928:                    return AlgorithmSuiteValue.Basic128Sha256Rsa15;
0929:                } else if (assertion.getName().getLocalPart().equals(
0930:                        TripleDesSha256Rsa15)) {
0931:                    return AlgorithmSuiteValue.TripleDesSha256Rsa15;
0932:                }
0933:                return null;
0934:            }
0935:
0936:            public static boolean isInclusiveC14N(PolicyAssertion assertion) {
0937:                if (!isSecurityPolicyNS(assertion)) {
0938:                    return false;
0939:                }
0940:
0941:                if (assertion.getName().getLocalPart().equals(InclusiveC14N)) {
0942:                    return true;
0943:                }
0944:                return false;
0945:
0946:            }
0947:
0948:            public static boolean isInclusiveC14NWithComments(
0949:                    PolicyAssertion assertion) {
0950:
0951:                if (!isSunPolicyNS(assertion)) {
0952:                    return false;
0953:                }
0954:                if (assertion.getName().getLocalPart().equals(
0955:                        InclusiveC14NWithComments)) {
0956:                    return true;
0957:                }
0958:                return false;
0959:            }
0960:
0961:            public static boolean isInclusiveC14NWithCommentsForTransforms(
0962:                    PolicyAssertion assertion) {
0963:
0964:                if (!isSunPolicyNS(assertion)) {
0965:                    return false;
0966:                }
0967:                if (assertion.getName().getLocalPart().equals(
0968:                        InclusiveC14NWithComments)) {
0969:                    if ("true".equals(assertion
0970:                            .getAttributeValue(new QName(
0971:                                    SUN_WSS_SECURITY_SERVER_POLICY_NS,
0972:                                    "forTransforms"))))
0973:                        return true;
0974:                }
0975:                return false;
0976:            }
0977:
0978:            public static boolean isInclusiveC14NWithCommentsForCm(
0979:                    PolicyAssertion assertion) {
0980:
0981:                if (!isSunPolicyNS(assertion)) {
0982:                    return false;
0983:                }
0984:                if (assertion.getName().getLocalPart().equals(
0985:                        InclusiveC14NWithComments)) {
0986:                    if ("true".equals(assertion.getAttributeValue(new QName(
0987:                            SUN_WSS_SECURITY_SERVER_POLICY_NS, "forCm"))))
0988:                        return true;
0989:                }
0990:                return false;
0991:            }
0992:
0993:            public static boolean isExclusiveC14NWithComments(
0994:                    PolicyAssertion assertion) {
0995:                if (!isSunPolicyNS(assertion)) {
0996:                    return false;
0997:                }
0998:                if (assertion.getName().getLocalPart().equals(
0999:                        ExclusiveC14NWithComments)) {
1000:                    return true;
1001:                }
1002:                return false;
1003:            }
1004:
1005:            public static boolean isExclusiveC14NWithCommentsForTransforms(
1006:                    PolicyAssertion assertion) {
1007:                if (!isSunPolicyNS(assertion)) {
1008:                    return false;
1009:                }
1010:                if (assertion.getName().getLocalPart().equals(
1011:                        ExclusiveC14NWithComments)) {
1012:                    if ("true".equals(assertion
1013:                            .getAttributeValue(new QName(
1014:                                    SUN_WSS_SECURITY_SERVER_POLICY_NS,
1015:                                    "forTransforms"))))
1016:                        return true;
1017:                }
1018:                return false;
1019:            }
1020:
1021:            public static boolean isExclusiveC14NWithCommentsForCm(
1022:                    PolicyAssertion assertion) {
1023:                if (!isSunPolicyNS(assertion)) {
1024:                    return false;
1025:                }
1026:                if (assertion.getName().getLocalPart().equals(
1027:                        ExclusiveC14NWithComments)) {
1028:                    if ("true".equals(assertion.getAttributeValue(new QName(
1029:                            SUN_WSS_SECURITY_SERVER_POLICY_NS, "forCm"))))
1030:                        return true;
1031:                }
1032:                return false;
1033:            }
1034:
1035:            public static boolean isSTRTransform10(PolicyAssertion assertion) {
1036:                if (!isSecurityPolicyNS(assertion)) {
1037:                    return false;
1038:                }
1039:
1040:                if (assertion.getName().getLocalPart().equals(STRTransform10)) {
1041:                    return true;
1042:                }
1043:                return false;
1044:            }
1045:
1046:            public static boolean isInitiatorToken(PolicyAssertion assertion) {
1047:                if (!isSecurityPolicyNS(assertion)) {
1048:                    return false;
1049:                }
1050:
1051:                if (assertion.getName().getLocalPart().equals(InitiatorToken)) {
1052:                    return true;
1053:                }
1054:                return false;
1055:            }
1056:
1057:            public static boolean isRecipientToken(PolicyAssertion assertion) {
1058:                if (!isSecurityPolicyNS(assertion)) {
1059:                    return false;
1060:                }
1061:
1062:                if (assertion.getName().getLocalPart().equals(RecipientToken)) {
1063:                    return true;
1064:                }
1065:                return false;
1066:            }
1067:
1068:            public static boolean isProtectTokens(PolicyAssertion assertion) {
1069:                if (!isSecurityPolicyNS(assertion)) {
1070:                    return false;
1071:                }
1072:
1073:                if (assertion.getName().getLocalPart().equals(ProtectTokens)) {
1074:                    return true;
1075:                }
1076:                return false;
1077:            }
1078:
1079:            public static boolean isEncryptSignature(PolicyAssertion assertion) {
1080:                if (!isSecurityPolicyNS(assertion)) {
1081:                    return false;
1082:                }
1083:
1084:                if (assertion.getName().getLocalPart().equals(EncryptSignature)) {
1085:                    return true;
1086:                }
1087:                return false;
1088:            }
1089:
1090:            public static boolean isCreated(PolicyAssertion assertion) {
1091:                if (!isUtilityNS(assertion)) {
1092:                    return false;
1093:                }
1094:
1095:                if (assertion.getName().getLocalPart().equals(Created)) {
1096:                    return true;
1097:                }
1098:                return false;
1099:            }
1100:
1101:            public static boolean isExpires(PolicyAssertion assertion) {
1102:                if (!isUtilityNS(assertion)) {
1103:                    return false;
1104:                }
1105:
1106:                if (assertion.getName().getLocalPart().equals(Expires)) {
1107:                    return true;
1108:                }
1109:                return false;
1110:            }
1111:
1112:            public static boolean isSignatureToken(PolicyAssertion assertion) {
1113:                if (!isSecurityPolicyNS(assertion)) {
1114:                    return false;
1115:                }
1116:
1117:                if (assertion.getName().getLocalPart().equals(SignatureToken)) {
1118:                    return true;
1119:                }
1120:
1121:                return false;
1122:            }
1123:
1124:            public static boolean isEncryptionToken(PolicyAssertion assertion) {
1125:                if (!isSecurityPolicyNS(assertion)) {
1126:                    return false;
1127:                }
1128:
1129:                if (assertion.getName().getLocalPart().equals(EncryptionToken)) {
1130:                    return true;
1131:                }
1132:                return false;
1133:            }
1134:
1135:            public static boolean isProtectionToken(PolicyAssertion assertion) {
1136:                if (!isSecurityPolicyNS(assertion)) {
1137:                    return false;
1138:                }
1139:
1140:                if (assertion.getName().getLocalPart().equals(ProtectionToken)) {
1141:                    return true;
1142:                }
1143:                return false;
1144:            }
1145:
1146:            public static boolean isAddress(PolicyAssertion assertion) {
1147:                if (!isAddressingNS(assertion)) {
1148:                    return false;
1149:                }
1150:
1151:                if (assertion.getName().getLocalPart().equals(Address)) {
1152:                    return true;
1153:                }
1154:
1155:                return false;
1156:            }
1157:
1158:            public static boolean isRequestSecurityTokenTemplate(
1159:                    PolicyAssertion assertion) {
1160:                if (!isSecurityPolicyNS(assertion)) {
1161:                    return false;
1162:                }
1163:
1164:                if (assertion.getName().getLocalPart().equals(
1165:                        RequestSecurityTokenTemplate)) {
1166:                    return true;
1167:                }
1168:                return false;
1169:            }
1170:
1171:            public static boolean isRequireExternalUriReference(
1172:                    PolicyAssertion assertion) {
1173:                if (!isSecurityPolicyNS(assertion)) {
1174:                    return false;
1175:                }
1176:
1177:                if (assertion.getName().getLocalPart().equals(
1178:                        RequireExternalUriReference)) {
1179:                    return true;
1180:                }
1181:
1182:                return false;
1183:            }
1184:
1185:            public static boolean isRequireExternalReference(
1186:                    PolicyAssertion assertion) {
1187:                if (!isSecurityPolicyNS(assertion)) {
1188:                    return false;
1189:                }
1190:
1191:                if (assertion.getName().getLocalPart().equals(
1192:                        RequireExternalReference)) {
1193:                    return true;
1194:                }
1195:
1196:                return false;
1197:            }
1198:
1199:            public static boolean isRequireInternalReference(
1200:                    PolicyAssertion assertion) {
1201:                if (!isSecurityPolicyNS(assertion)) {
1202:                    return false;
1203:                }
1204:
1205:                if (assertion.getName().getLocalPart().equals(
1206:                        RequireInternalReference)) {
1207:                    return true;
1208:                }
1209:
1210:                return false;
1211:            }
1212:
1213:            public static boolean isEndpointReference(PolicyAssertion assertion) {
1214:                if (!isAddressingNS(assertion)) {
1215:                    return false;
1216:                }
1217:
1218:                if (assertion.getName().getLocalPart()
1219:                        .equals(EndpointReference)) {
1220:                    return true;
1221:                }
1222:                return false;
1223:            }
1224:
1225:            public static boolean isLax(PolicyAssertion assertion) {
1226:                if (!isSecurityPolicyNS(assertion)) {
1227:                    return false;
1228:                }
1229:
1230:                if (assertion.getName().getLocalPart().equals(Lax)) {
1231:                    return true;
1232:                }
1233:                return false;
1234:            }
1235:
1236:            public static boolean isLaxTsFirst(PolicyAssertion assertion) {
1237:                if (!isSecurityPolicyNS(assertion)) {
1238:                    return false;
1239:                }
1240:
1241:                if (assertion.getName().getLocalPart().equals(LaxTsFirst)) {
1242:                    return true;
1243:                }
1244:                return false;
1245:            }
1246:
1247:            public static boolean isLaxTsLast(PolicyAssertion assertion) {
1248:                if (!isSecurityPolicyNS(assertion)) {
1249:                    return false;
1250:                }
1251:
1252:                if (assertion.getName().getLocalPart().equals(LaxTsLast)) {
1253:                    return true;
1254:                }
1255:                return false;
1256:            }
1257:
1258:            public static boolean isStrict(PolicyAssertion assertion) {
1259:                if (!isSecurityPolicyNS(assertion)) {
1260:                    return false;
1261:                }
1262:
1263:                if (assertion.getName().getLocalPart().equals(Strict)) {
1264:                    return true;
1265:                }
1266:                return false;
1267:            }
1268:
1269:            public static boolean isKeyType(PolicyAssertion assertion) {
1270:                if (!isTrustNS(assertion)) {
1271:                    return false;
1272:                }
1273:
1274:                if (assertion.getName().getLocalPart().equals(KeyType)) {
1275:                    return true;
1276:                }
1277:
1278:                return false;
1279:            }
1280:
1281:            public static boolean isKeySize(PolicyAssertion assertion) {
1282:                if (!isTrustNS(assertion)) {
1283:                    return false;
1284:                }
1285:
1286:                if (assertion.getName().getLocalPart().equals(KeySize)) {
1287:                    return true;
1288:                }
1289:
1290:                return false;
1291:            }
1292:
1293:            public static boolean isUseKey(PolicyAssertion assertion) {
1294:                if (!isTrustNS(assertion)) {
1295:                    return false;
1296:                }
1297:
1298:                if (assertion.getName().getLocalPart().equals(UseKey)) {
1299:                    return true;
1300:                }
1301:
1302:                return false;
1303:            }
1304:
1305:            public static boolean isEncryption(PolicyAssertion assertion) {
1306:                if (!isTrustNS(assertion)) {
1307:                    return false;
1308:                }
1309:
1310:                if (assertion.getName().getLocalPart().equals(Encryption)) {
1311:                    return true;
1312:                }
1313:                return false;
1314:            }
1315:
1316:            public static boolean isProofEncryption(PolicyAssertion assertion) {
1317:                if (!isTrustNS(assertion)) {
1318:                    return false;
1319:                }
1320:
1321:                if (assertion.getName().getLocalPart().equals(ProofEncryption)) {
1322:                    return true;
1323:                }
1324:                return false;
1325:            }
1326:
1327:            public static boolean isLifeTime(PolicyAssertion assertion) {
1328:                if (!isTrustNS(assertion)) {
1329:                    return false;
1330:                }
1331:
1332:                if (assertion.getName().getLocalPart().equals(Lifetime)) {
1333:                    return true;
1334:                }
1335:                return false;
1336:            }
1337:
1338:            public static boolean isHeader(PolicyAssertion assertion) {
1339:                if (!isSecurityPolicyNS(assertion)) {
1340:                    return false;
1341:                }
1342:                if (assertion.getName().getLocalPart().equals(HEADER)) {
1343:                    return true;
1344:                }
1345:                return false;
1346:            }
1347:
1348:            public static boolean isRequireKeyIR(PolicyAssertion assertion) {
1349:                if (!isSecurityPolicyNS(assertion)) {
1350:                    return false;
1351:                }
1352:                if (assertion.getName().getLocalPart().equals(
1353:                        RequireKeyIdentifierReference)) {
1354:                    return true;
1355:                }
1356:                return false;
1357:            }
1358:
1359:            public static boolean isSignWith(PolicyAssertion assertion) {
1360:                if (!isTrustNS(assertion)) {
1361:                    return false;
1362:                }
1363:                if (SignWith.equals(assertion.getName().getLocalPart())) {
1364:                    return true;
1365:                }
1366:                return false;
1367:            }
1368:
1369:            public static boolean isRequestType(PolicyAssertion assertion) {
1370:                if (!isTrustNS(assertion)) {
1371:                    return false;
1372:                }
1373:                if (RequestType.equals(assertion.getName().getLocalPart())) {
1374:                    return true;
1375:                }
1376:                return false;
1377:            }
1378:
1379:            public static boolean isSignatureAlgorithm(PolicyAssertion assertion) {
1380:                if (!isTrustNS(assertion)) {
1381:                    return false;
1382:                }
1383:                if (SignatureAlgorithm.equals(assertion.getName()
1384:                        .getLocalPart())) {
1385:                    return true;
1386:                }
1387:                return false;
1388:            }
1389:
1390:            public static boolean isComputedKeyAlgorithm(
1391:                    PolicyAssertion assertion) {
1392:                if (!isTrustNS(assertion)) {
1393:                    return false;
1394:                }
1395:                if (ComputedKeyAlgorithm.equals(assertion.getName()
1396:                        .getLocalPart())) {
1397:                    return true;
1398:                }
1399:                return false;
1400:            }
1401:
1402:            public static boolean isCanonicalizationAlgorithm(
1403:                    PolicyAssertion assertion) {
1404:                if (!isTrustNS(assertion)) {
1405:                    return false;
1406:                }
1407:                if (CanonicalizationAlgorithm.equals(assertion.getName()
1408:                        .getLocalPart())) {
1409:                    return true;
1410:                }
1411:                return false;
1412:            }
1413:
1414:            public static boolean isEncryptionAlgorithm(
1415:                    PolicyAssertion assertion) {
1416:                if (!isTrustNS(assertion)) {
1417:                    return false;
1418:                }
1419:                if (EncryptionAlgorithm.equals(assertion.getName()
1420:                        .getLocalPart())) {
1421:                    return true;
1422:                }
1423:                return false;
1424:            }
1425:
1426:            public static boolean isAuthenticationType(PolicyAssertion assertion) {
1427:                if (!isTrustNS(assertion)) {
1428:                    return false;
1429:                }
1430:                if (AuthenticationType.equals(assertion.getName()
1431:                        .getLocalPart())) {
1432:                    return true;
1433:                }
1434:                return false;
1435:            }
1436:
1437:            public static boolean isSC10SecurityContextToken(
1438:                    PolicyAssertion assertion) {
1439:                if (!isSecurityPolicyNS(assertion)) {
1440:                    return false;
1441:                }
1442:
1443:                if (assertion.getName().getLocalPart().equals(
1444:                        Constants.SC10SecurityContextToken)) {
1445:                    return true;
1446:                }
1447:                return false;
1448:            }
1449:
1450:            public static boolean isConfigPolicyAssertion(
1451:                    PolicyAssertion assertion) {
1452:                String uri = assertion.getName().getNamespaceURI();
1453:                if (SUN_SECURE_CLIENT_CONVERSATION_POLICY_NS.equals(uri)
1454:                        || SUN_TRUST_CLIENT_SECURITY_POLICY_NS.equals(uri)
1455:                        || SUN_SECURE_SERVER_CONVERSATION_POLICY_NS.equals(uri)
1456:                        || SUN_TRUST_SERVER_SECURITY_POLICY_NS.equals(uri)
1457:                        || SUN_WSS_SECURITY_CLIENT_POLICY_NS.equals(uri)
1458:                        || SUN_WSS_SECURITY_SERVER_POLICY_NS.equals(uri)) {
1459:                    return true;
1460:                }
1461:                return false;
1462:            }
1463:
1464:            public static boolean isTrustTokenType(PolicyAssertion assertion) {
1465:                if (!isTrustNS(assertion)) {
1466:                    return false;
1467:                }
1468:                if (TokenType.equals(assertion.getName().getLocalPart())) {
1469:                    return true;
1470:                }
1471:                return false;
1472:            }
1473:
1474:            public static boolean isPortType(PolicyAssertion assertion) {
1475:                if (!isAddressingNS(assertion)) {
1476:                    return false;
1477:                }
1478:
1479:                if (assertion.getName().getLocalPart().equals(PortType)) {
1480:                    return true;
1481:                }
1482:                return false;
1483:            }
1484:
1485:            public static boolean isReferenceParameters(
1486:                    PolicyAssertion assertion) {
1487:                if (!isAddressingNS(assertion)) {
1488:                    return false;
1489:                }
1490:
1491:                if (assertion.getName().getLocalPart().equals(
1492:                        ReferenceParameters)) {
1493:                    return true;
1494:                }
1495:                return false;
1496:            }
1497:
1498:            public static boolean isReferenceProperties(
1499:                    PolicyAssertion assertion) {
1500:                if (!isAddressingNS(assertion)) {
1501:                    return false;
1502:                }
1503:
1504:                if (assertion.getName().getLocalPart().equals(
1505:                        ReferenceProperties)) {
1506:                    return true;
1507:                }
1508:                return false;
1509:            }
1510:
1511:            public static boolean isServiceName(PolicyAssertion assertion) {
1512:                if (!isAddressingNS(assertion)) {
1513:                    return false;
1514:                }
1515:
1516:                if (assertion.getName().getLocalPart().equals(ServiceName)) {
1517:                    return true;
1518:                }
1519:                return false;
1520:            }
1521:
1522:            public static boolean isRequiredElements(PolicyAssertion assertion) {
1523:                if (isSecurityPolicyNS(assertion)) {
1524:                    return false;
1525:                }
1526:
1527:                if (assertion.getName().getLocalPart().equals(RequiredElements)) {
1528:                    return true;
1529:                }
1530:                return false;
1531:            }
1532:
1533:            public static boolean isClaimsElement(PolicyAssertion assertion) {
1534:                if (!isTrustNS(assertion)) {
1535:                    return false;
1536:                }
1537:                if (Claims.equals(assertion.getName().getLocalPart())) {
1538:                    return true;
1539:                }
1540:                return false;
1541:            }
1542:
1543:            public static boolean isEntropyElement(PolicyAssertion assertion) {
1544:                if (!isTrustNS(assertion)) {
1545:                    return false;
1546:                }
1547:                if (Entropy.equals(assertion.getName().getLocalPart())) {
1548:                    return true;
1549:                }
1550:                return false;
1551:            }
1552:
1553:            public static boolean hasPassword(PolicyAssertion assertion) {
1554:                if (!isSecurityPolicyNS(assertion)) {
1555:                    return false;
1556:                }
1557:
1558:                if (assertion.getName().getLocalPart().equals(NoPassword)) {
1559:                    return true;
1560:                }
1561:                return false;
1562:            }
1563:        }
w_w__w___.___j__a__va2___s__.___c_o_m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.