Source Code Cross Referenced for WSCSecurityPanel.java in  » IDE-Netbeans » identity.kit » org » netbeans » modules » identity » profile » ui » 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 » IDE Netbeans » identity.kit » org.netbeans.modules.identity.profile.ui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * The Original Software is NetBeans. The Initial Developer of the Original
027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028:         * Microsystems, Inc. All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         */
041:
042:        package org.netbeans.modules.identity.profile.ui;
043:
044:        import java.io.File;
045:        import java.util.ArrayList;
046:        import java.util.Collection;
047:        import java.util.List;
048:        import javax.swing.JComponent;
049:        import javax.swing.JFileChooser;
050:        import javax.swing.filechooser.FileFilter;
051:        import org.netbeans.modules.identity.profile.api.configurator.Configurator.AccessMethod;
052:        import org.netbeans.modules.identity.profile.api.configurator.ConfiguratorException;
053:        import org.netbeans.modules.identity.profile.api.configurator.ProviderConfigurator;
054:        import org.netbeans.modules.identity.profile.api.configurator.ProviderConfigurator.Configurable;
055:        import org.netbeans.modules.identity.profile.api.configurator.ProviderConfigurator.Type;
056:        import org.netbeans.modules.identity.profile.api.configurator.SecurityMechanism;
057:        import org.netbeans.modules.identity.profile.api.configurator.SecurityMechanismHelper;
058:        import org.netbeans.modules.identity.profile.ui.support.J2eeProjectHelper;
059:        import org.netbeans.modules.identity.profile.ui.support.J2eeProjectHelper.ProjectType;
060:        import org.netbeans.modules.identity.server.manager.api.ServerManager;
061:        import org.netbeans.modules.xml.multiview.ui.SectionNodeInnerPanel;
062:        import org.netbeans.modules.xml.multiview.ui.SectionNodeView;
063:        import org.openide.util.NbBundle;
064:
065:        /**
066:         * Visual panel for the WSC security panel.
067:         *
068:         * Created on April 14, 2006, 3:03 PM
069:         *
070:         * @author  ptliu
071:         * @author Srividhya Narayanan
072:         */
073:        public class WSCSecurityPanel extends SectionNodeInnerPanel {
074:
075:            private static final String JKS_EXTENSION = ".jks"; //NOI18N
076:            private static final String URN = "urn:"; //NOI18N
077:            private Collection<ProviderConfigurator> configurators;
078:            private J2eeProjectHelper helper;
079:            private boolean disabled = false;
080:
081:            /** Creates new form WSPSecurityPanel */
082:            public WSCSecurityPanel(SectionNodeView view,
083:                    J2eeProjectHelper helper) {
084:                super (view);
085:                initComponents();
086:
087:                errorLabel.setText(""); //NOI18N
088:                configurators = new ArrayList<ProviderConfigurator>();
089:
090:                try {
091:                    List<String> services = helper.getAllServiceNames();
092:
093:                    for (String service : services) {
094:                        configurators
095:                                .add(ProviderConfigurator.getConfigurator(
096:                                        service, Type.WSC, AccessMethod.FILE,
097:                                        helper.getConfigPath(), helper
098:                                                .getServerID()));
099:                    }
100:                } catch (ConfiguratorException ex) {
101:                    errorLabel.setText(ex.getMessage());
102:                    disabled = true;
103:                }
104:
105:                this .helper = helper;
106:
107:                if (!disabled) {
108:                    if (helper.isSecurityEnabled()) {
109:                        enableSecurityCB.setSelected(true);
110:                    } else {
111:                        enableSecurityCB.setSelected(false);
112:                    }
113:
114:                    for (ProviderConfigurator configurator : configurators) {
115:                        configurator
116:                                .addModifier(
117:                                        Configurable.SECURITY_MECH,
118:                                        requestSecMechCB,
119:                                        (helper.getProjectType() == ProjectType.WEB) ? configurator
120:                                                .getSecMechHelper()
121:                                                .getAllWSCSecurityMechanisms()
122:                                                : configurator
123:                                                        .getSecMechHelper()
124:                                                        .getAllMessageLevelSecurityMechanisms());
125:
126:                        configurator.addModifier(Configurable.SIGN_RESPONSE,
127:                                signResponseCB);
128:                        configurator.addModifier(
129:                                Configurable.USE_DEFAULT_KEYSTORE,
130:                                useDefaultKeyStoreCB);
131:                        configurator.addModifier(
132:                                Configurable.KEYSTORE_LOCATION,
133:                                keystoreLocationTF);
134:                        configurator.addModifier(
135:                                Configurable.KEYSTORE_PASSWORD,
136:                                keystorePasswordTF);
137:                        configurator.addModifier(Configurable.KEY_ALIAS,
138:                                keyAliasTF);
139:                        configurator.addModifier(Configurable.KEY_PASSWORD,
140:                                this .keyPasswordTF);
141:                        configurator.addModifier(Configurable.USERNAME,
142:                                userNameTF);
143:                        configurator.addModifier(Configurable.PASSWORD,
144:                                passwordTF);
145:
146:                        configurator.addErrorComponent(errorLabel);
147:                    }
148:                }
149:
150:                updateVisualState();
151:            }
152:
153:            public JComponent getErrorComponent(String errorId) {
154:                return null;
155:            }
156:
157:            public void setValue(JComponent source, Object value) {
158:            }
159:
160:            public void linkButtonPressed(Object ddBean, String ddProperty) {
161:            }
162:
163:            private void updateVisualState() {
164:                if (disabled) {
165:                    disableAll();
166:                    enableSecurityCB.setEnabled(false);
167:                    return;
168:                }
169:
170:                if (helper.isWsitSecurityEnabled()) {
171:                    enableSecurityCB.setEnabled(false);
172:                    errorLabel.setText(NbBundle.getMessage(
173:                            WSCSecurityPanel.class, "MSG_WsitEnabled"));
174:                } else {
175:                    enableSecurityCB.setEnabled(true);
176:                    errorLabel.setText(""); //NOI18N
177:                }
178:
179:                if (enableSecurityCB.isSelected()
180:                        && enableSecurityCB.isEnabled()) {
181:                    secMechLabel.setEnabled(true);
182:                    requestLabel.setEnabled(true);
183:                    requestSecMechCB.setEnabled(true);
184:                    userNameLabel.setEnabled(true);
185:                    userNameTF.setEnabled(true);
186:                    passwordLabel.setEnabled(true);
187:                    passwordTF.setEnabled(true);
188:                    responseLabel.setEnabled(true);
189:                    signResponseCB.setEnabled(true);
190:                    certSettingsLabel.setEnabled(true);
191:                    useDefaultKeyStoreCB.setEnabled(true);
192:
193:                    if (!useDefaultKeyStoreCB.isSelected()) {
194:                        keystoreLocationLabel.setEnabled(true);
195:                        keystoreLocationTF.setEnabled(true);
196:                        keystorePasswordLabel.setEnabled(true);
197:                        keystorePasswordTF.setEnabled(true);
198:                        keyAliasLabel.setEnabled(true);
199:                        keyAliasTF.setEnabled(true);
200:                        keyAliasPasswordLabel.setEnabled(true);
201:                        keyPasswordTF.setEnabled(true);
202:                        browseButton.setEnabled(true);
203:                    } else {
204:                        keystoreLocationLabel.setEnabled(false);
205:                        keystoreLocationTF.setEnabled(false);
206:                        keystorePasswordLabel.setEnabled(false);
207:                        keystorePasswordTF.setEnabled(false);
208:                        keyAliasLabel.setEnabled(false);
209:                        keyAliasTF.setEnabled(false);
210:                        keyAliasPasswordLabel.setEnabled(false);
211:                        keyPasswordTF.setEnabled(false);
212:                        browseButton.setEnabled(false);
213:                    }
214:                } else {
215:                    disableAll();
216:                }
217:
218:                SecurityMechanism secMech = (SecurityMechanism) requestSecMechCB
219:                        .getSelectedItem();
220:
221:                if (secMech.isPasswordCredentialRequired()
222:                        && requestSecMechCB.isEnabled()) {
223:                    userNameLabel.setVisible(true);
224:                    userNameTF.setVisible(true);
225:                    passwordLabel.setVisible(true);
226:                    passwordTF.setVisible(true);
227:                } else {
228:                    userNameLabel.setVisible(false);
229:                    userNameTF.setVisible(false);
230:                    passwordLabel.setVisible(false);
231:                    passwordTF.setVisible(false);
232:                }
233:            }
234:
235:            private void disableAll() {
236:                secMechLabel.setEnabled(false);
237:                requestLabel.setEnabled(false);
238:                requestSecMechCB.setEnabled(false);
239:                userNameLabel.setEnabled(false);
240:                userNameTF.setEnabled(false);
241:                passwordLabel.setEnabled(false);
242:                passwordTF.setEnabled(false);
243:                responseLabel.setEnabled(false);
244:                signResponseCB.setEnabled(false);
245:                certSettingsLabel.setEnabled(false);
246:                useDefaultKeyStoreCB.setEnabled(false);
247:                keystoreLocationLabel.setEnabled(false);
248:                keystoreLocationTF.setEnabled(false);
249:                keystorePasswordLabel.setEnabled(false);
250:                keystorePasswordTF.setEnabled(false);
251:                keyAliasLabel.setEnabled(false);
252:                keyAliasTF.setEnabled(false);
253:                keyAliasPasswordLabel.setEnabled(false);
254:                keyPasswordTF.setEnabled(false);
255:                browseButton.setEnabled(false);
256:                userNameLabel.setVisible(false);
257:                userNameTF.setVisible(false);
258:                passwordLabel.setVisible(false);
259:                passwordTF.setVisible(false);
260:            }
261:
262:            public void save() {
263:                if (!disabled) {
264:                    if (enableSecurityCB.isSelected()) {
265:                        for (ProviderConfigurator configurator : configurators) {
266:                            configurator.save();
267:                        }
268:                        /*
269:                        if (isLiberty()) {
270:                        helper.addAMSecurityConstraint();
271:                        } else {
272:                        helper.removeAMSecurityConstraint();
273:                        }
274:                         */
275:                        helper.enableWSCSecurity(isLiberty());
276:                    } else {
277:                        //helper.removeAMSecurityConstraint();
278:                        helper.disableWSCSecurity();
279:                        for (ProviderConfigurator configurator : configurators) {
280:                            configurator.disable();
281:                            configurator.save();
282:                        }
283:                    }
284:                }
285:
286:                for (ProviderConfigurator configurator : configurators) {
287:                    configurator.close();
288:                }
289:                helper.clearTransientState();
290:            }
291:
292:            public void cancel() {
293:                for (ProviderConfigurator configurator : configurators) {
294:                    configurator.close();
295:                }
296:                helper.clearTransientState();
297:            }
298:
299:            private boolean isLiberty() {
300:                SecurityMechanism secMech = (SecurityMechanism) requestSecMechCB
301:                        .getSelectedItem();
302:
303:                return secMech.isLiberty();
304:            }
305:
306:            /** This method is called from within the constructor to
307:             * initialize the form.
308:             * WARNING: Do NOT modify this code. The content of this method is
309:             * always regenerated by the Form Editor.
310:             */
311:            // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
312:            private void initComponents() {
313:
314:                jSeparator2 = new javax.swing.JSeparator();
315:                enableSecurityCB = new javax.swing.JCheckBox();
316:                secMechLabel = new javax.swing.JLabel();
317:                requestLabel = new javax.swing.JLabel();
318:                requestSecMechCB = new javax.swing.JComboBox();
319:                userNameLabel = new javax.swing.JLabel();
320:                userNameTF = new javax.swing.JTextField();
321:                passwordLabel = new javax.swing.JLabel();
322:                responseLabel = new javax.swing.JLabel();
323:                signResponseCB = new javax.swing.JCheckBox();
324:                certSettingsLabel = new javax.swing.JLabel();
325:                keystoreLocationLabel = new javax.swing.JLabel();
326:                keystoreLocationTF = new javax.swing.JTextField();
327:                keystorePasswordLabel = new javax.swing.JLabel();
328:                keyAliasLabel = new javax.swing.JLabel();
329:                keyAliasTF = new javax.swing.JTextField();
330:                keyAliasPasswordLabel = new javax.swing.JLabel();
331:                jSeparator1 = new javax.swing.JSeparator();
332:                browseButton = new javax.swing.JButton();
333:                keystorePasswordTF = new javax.swing.JPasswordField();
334:                keyPasswordTF = new javax.swing.JPasswordField();
335:                useDefaultKeyStoreCB = new javax.swing.JCheckBox();
336:                passwordTF = new javax.swing.JPasswordField();
337:                errorLabel = new javax.swing.JLabel();
338:
339:                setEnabled(false);
340:                addFocusListener(new java.awt.event.FocusAdapter() {
341:                    public void focusGained(java.awt.event.FocusEvent evt) {
342:                        formFocusGained(evt);
343:                    }
344:                });
345:                addAncestorListener(new javax.swing.event.AncestorListener() {
346:                    public void ancestorMoved(
347:                            javax.swing.event.AncestorEvent evt) {
348:                    }
349:
350:                    public void ancestorAdded(
351:                            javax.swing.event.AncestorEvent evt) {
352:                        formAncestorAdded(evt);
353:                    }
354:
355:                    public void ancestorRemoved(
356:                            javax.swing.event.AncestorEvent evt) {
357:                    }
358:                });
359:
360:                java.util.ResourceBundle bundle = java.util.ResourceBundle
361:                        .getBundle("org/netbeans/modules/identity/profile/ui/Bundle"); // NOI18N
362:                org.openide.awt.Mnemonics.setLocalizedText(enableSecurityCB,
363:                        bundle.getString("LBL_EnableSecurity")); // NOI18N
364:                enableSecurityCB.setBorder(javax.swing.BorderFactory
365:                        .createEmptyBorder(0, 0, 0, 0));
366:                enableSecurityCB.setMargin(new java.awt.Insets(0, 0, 0, 0));
367:                enableSecurityCB.setOpaque(false);
368:                enableSecurityCB
369:                        .addActionListener(new java.awt.event.ActionListener() {
370:                            public void actionPerformed(
371:                                    java.awt.event.ActionEvent evt) {
372:                                enableSecurityCBActionPerformed(evt);
373:                            }
374:                        });
375:
376:                secMechLabel
377:                        .setText(bundle.getString("LBL_SecurityMechanisms")); // NOI18N
378:
379:                requestLabel.setLabelFor(requestSecMechCB);
380:                org.openide.awt.Mnemonics.setLocalizedText(requestLabel, bundle
381:                        .getString("LBL_Request")); // NOI18N
382:
383:                requestSecMechCB
384:                        .addActionListener(new java.awt.event.ActionListener() {
385:                            public void actionPerformed(
386:                                    java.awt.event.ActionEvent evt) {
387:                                requestSecMechCBActionPerformed(evt);
388:                            }
389:                        });
390:
391:                userNameLabel.setLabelFor(userNameTF);
392:                org.openide.awt.Mnemonics.setLocalizedText(userNameLabel,
393:                        bundle.getString("LBL_UserName")); // NOI18N
394:
395:                passwordLabel.setLabelFor(passwordTF);
396:                org.openide.awt.Mnemonics.setLocalizedText(passwordLabel,
397:                        bundle.getString("LBL_Password")); // NOI18N
398:
399:                responseLabel.setText(bundle.getString("LBL_Response")); // NOI18N
400:
401:                org.openide.awt.Mnemonics.setLocalizedText(signResponseCB,
402:                        bundle.getString("LBL_VerifyResponse")); // NOI18N
403:                signResponseCB.setBorder(javax.swing.BorderFactory
404:                        .createEmptyBorder(0, 0, 0, 0));
405:                signResponseCB.setMargin(new java.awt.Insets(0, 0, 0, 0));
406:                signResponseCB.setOpaque(false);
407:
408:                certSettingsLabel.setText(bundle
409:                        .getString("LBL_CertificateSettings")); // NOI18N
410:
411:                keystoreLocationLabel.setLabelFor(keystoreLocationTF);
412:                org.openide.awt.Mnemonics.setLocalizedText(
413:                        keystoreLocationLabel, bundle
414:                                .getString("LBL_KeyStoreLocation")); // NOI18N
415:
416:                keystorePasswordLabel.setLabelFor(keystorePasswordTF);
417:                org.openide.awt.Mnemonics.setLocalizedText(
418:                        keystorePasswordLabel, bundle
419:                                .getString("LBL_KeystorePassword")); // NOI18N
420:
421:                keyAliasLabel.setLabelFor(keyAliasTF);
422:                org.openide.awt.Mnemonics.setLocalizedText(keyAliasLabel,
423:                        bundle.getString("LBL_KeyAlias")); // NOI18N
424:
425:                keyAliasPasswordLabel.setLabelFor(keyPasswordTF);
426:                org.openide.awt.Mnemonics.setLocalizedText(
427:                        keyAliasPasswordLabel, bundle
428:                                .getString("LBL_KeyAliasPassword")); // NOI18N
429:
430:                org.openide.awt.Mnemonics.setLocalizedText(browseButton, bundle
431:                        .getString("LBL_Browse")); // NOI18N
432:                browseButton
433:                        .addActionListener(new java.awt.event.ActionListener() {
434:                            public void actionPerformed(
435:                                    java.awt.event.ActionEvent evt) {
436:                                browseButtonActionPerformed(evt);
437:                            }
438:                        });
439:
440:                org.openide.awt.Mnemonics.setLocalizedText(
441:                        useDefaultKeyStoreCB, bundle
442:                                .getString("LBL_UseDefaultKeyStore")); // NOI18N
443:                useDefaultKeyStoreCB.setBorder(javax.swing.BorderFactory
444:                        .createEmptyBorder(0, 0, 0, 0));
445:                useDefaultKeyStoreCB.setMargin(new java.awt.Insets(0, 0, 0, 0));
446:                useDefaultKeyStoreCB.setOpaque(false);
447:                useDefaultKeyStoreCB
448:                        .addActionListener(new java.awt.event.ActionListener() {
449:                            public void actionPerformed(
450:                                    java.awt.event.ActionEvent evt) {
451:                                useDefaultKeyStoreCBActionPerformed(evt);
452:                            }
453:                        });
454:
455:                errorLabel.setForeground(java.awt.Color.red);
456:                errorLabel.setText("Error:");
457:
458:                org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(
459:                        this );
460:                this .setLayout(layout);
461:                layout
462:                        .setHorizontalGroup(layout
463:                                .createParallelGroup(
464:                                        org.jdesktop.layout.GroupLayout.LEADING)
465:                                .add(
466:                                        layout
467:                                                .createSequentialGroup()
468:                                                .addContainerGap()
469:                                                .add(
470:                                                        layout
471:                                                                .createParallelGroup(
472:                                                                        org.jdesktop.layout.GroupLayout.LEADING)
473:                                                                .add(
474:                                                                        secMechLabel)
475:                                                                .add(
476:                                                                        layout
477:                                                                                .createSequentialGroup()
478:                                                                                .add(
479:                                                                                        10,
480:                                                                                        10,
481:                                                                                        10)
482:                                                                                .add(
483:                                                                                        layout
484:                                                                                                .createParallelGroup(
485:                                                                                                        org.jdesktop.layout.GroupLayout.LEADING)
486:                                                                                                .add(
487:                                                                                                        layout
488:                                                                                                                .createSequentialGroup()
489:                                                                                                                .add(
490:                                                                                                                        requestLabel)
491:                                                                                                                .addPreferredGap(
492:                                                                                                                        org.jdesktop.layout.LayoutStyle.RELATED)
493:                                                                                                                .add(
494:                                                                                                                        requestSecMechCB,
495:                                                                                                                        0,
496:                                                                                                                        343,
497:                                                                                                                        Short.MAX_VALUE))
498:                                                                                                .add(
499:                                                                                                        layout
500:                                                                                                                .createSequentialGroup()
501:                                                                                                                .add(
502:                                                                                                                        10,
503:                                                                                                                        10,
504:                                                                                                                        10)
505:                                                                                                                .add(
506:                                                                                                                        layout
507:                                                                                                                                .createParallelGroup(
508:                                                                                                                                        org.jdesktop.layout.GroupLayout.LEADING)
509:                                                                                                                                .add(
510:                                                                                                                                        passwordLabel)
511:                                                                                                                                .add(
512:                                                                                                                                        userNameLabel))
513:                                                                                                                .add(
514:                                                                                                                        6,
515:                                                                                                                        6,
516:                                                                                                                        6)
517:                                                                                                                .add(
518:                                                                                                                        layout
519:                                                                                                                                .createParallelGroup(
520:                                                                                                                                        org.jdesktop.layout.GroupLayout.LEADING)
521:                                                                                                                                .add(
522:                                                                                                                                        passwordTF,
523:                                                                                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
524:                                                                                                                                        320,
525:                                                                                                                                        Short.MAX_VALUE)
526:                                                                                                                                .add(
527:                                                                                                                                        userNameTF,
528:                                                                                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
529:                                                                                                                                        320,
530:                                                                                                                                        Short.MAX_VALUE))
531:                                                                                                                .addPreferredGap(
532:                                                                                                                        org.jdesktop.layout.LayoutStyle.RELATED))
533:                                                                                                .add(
534:                                                                                                        layout
535:                                                                                                                .createSequentialGroup()
536:                                                                                                                .add(
537:                                                                                                                        responseLabel)
538:                                                                                                                .addPreferredGap(
539:                                                                                                                        org.jdesktop.layout.LayoutStyle.RELATED)
540:                                                                                                                .add(
541:                                                                                                                        signResponseCB))))
542:                                                                .add(
543:                                                                        certSettingsLabel)
544:                                                                .add(
545:                                                                        layout
546:                                                                                .createSequentialGroup()
547:                                                                                .add(
548:                                                                                        10,
549:                                                                                        10,
550:                                                                                        10)
551:                                                                                .add(
552:                                                                                        layout
553:                                                                                                .createParallelGroup(
554:                                                                                                        org.jdesktop.layout.GroupLayout.LEADING)
555:                                                                                                .add(
556:                                                                                                        layout
557:                                                                                                                .createSequentialGroup()
558:                                                                                                                .add(
559:                                                                                                                        keystoreLocationLabel)
560:                                                                                                                .add(
561:                                                                                                                        10,
562:                                                                                                                        10,
563:                                                                                                                        10)
564:                                                                                                                .add(
565:                                                                                                                        keystoreLocationTF,
566:                                                                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
567:                                                                                                                        202,
568:                                                                                                                        Short.MAX_VALUE))
569:                                                                                                .add(
570:                                                                                                        useDefaultKeyStoreCB)
571:                                                                                                .add(
572:                                                                                                        layout
573:                                                                                                                .createSequentialGroup()
574:                                                                                                                .add(
575:                                                                                                                        layout
576:                                                                                                                                .createParallelGroup(
577:                                                                                                                                        org.jdesktop.layout.GroupLayout.LEADING)
578:                                                                                                                                .add(
579:                                                                                                                                        keystorePasswordLabel)
580:                                                                                                                                .add(
581:                                                                                                                                        keyAliasLabel)
582:                                                                                                                                .add(
583:                                                                                                                                        keyAliasPasswordLabel))
584:                                                                                                                .addPreferredGap(
585:                                                                                                                        org.jdesktop.layout.LayoutStyle.RELATED)
586:                                                                                                                .add(
587:                                                                                                                        layout
588:                                                                                                                                .createParallelGroup(
589:                                                                                                                                        org.jdesktop.layout.GroupLayout.LEADING)
590:                                                                                                                                .add(
591:                                                                                                                                        layout
592:                                                                                                                                                .createSequentialGroup()
593:                                                                                                                                                .addPreferredGap(
594:                                                                                                                                                        org.jdesktop.layout.LayoutStyle.RELATED)
595:                                                                                                                                                .add(
596:                                                                                                                                                        keyPasswordTF,
597:                                                                                                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
598:                                                                                                                                                        197,
599:                                                                                                                                                        Short.MAX_VALUE))
600:                                                                                                                                .add(
601:                                                                                                                                        keyAliasTF,
602:                                                                                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
603:                                                                                                                                        197,
604:                                                                                                                                        Short.MAX_VALUE)
605:                                                                                                                                .add(
606:                                                                                                                                        keystorePasswordTF,
607:                                                                                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
608:                                                                                                                                        197,
609:                                                                                                                                        Short.MAX_VALUE))))
610:                                                                                .addPreferredGap(
611:                                                                                        org.jdesktop.layout.LayoutStyle.RELATED)
612:                                                                                .add(
613:                                                                                        browseButton))
614:                                                                .add(
615:                                                                        enableSecurityCB)
616:                                                                .add(
617:                                                                        jSeparator1,
618:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
619:                                                                        409,
620:                                                                        Short.MAX_VALUE)
621:                                                                .add(errorLabel))
622:                                                .addContainerGap()));
623:                layout
624:                        .setVerticalGroup(layout
625:                                .createParallelGroup(
626:                                        org.jdesktop.layout.GroupLayout.LEADING)
627:                                .add(
628:                                        layout
629:                                                .createSequentialGroup()
630:                                                .addContainerGap()
631:                                                .add(
632:                                                        enableSecurityCB,
633:                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
634:                                                        15,
635:                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
636:                                                .addPreferredGap(
637:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
638:                                                .add(secMechLabel)
639:                                                .addPreferredGap(
640:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
641:                                                .add(
642:                                                        layout
643:                                                                .createParallelGroup(
644:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
645:                                                                .add(
646:                                                                        requestLabel)
647:                                                                .add(
648:                                                                        requestSecMechCB,
649:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
650:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
651:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
652:                                                .addPreferredGap(
653:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
654:                                                .add(
655:                                                        layout
656:                                                                .createParallelGroup(
657:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
658:                                                                .add(
659:                                                                        userNameTF,
660:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
661:                                                                        19,
662:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
663:                                                                .add(
664:                                                                        userNameLabel))
665:                                                .add(11, 11, 11)
666:                                                .add(
667:                                                        layout
668:                                                                .createParallelGroup(
669:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
670:                                                                .add(
671:                                                                        passwordLabel)
672:                                                                .add(
673:                                                                        passwordTF,
674:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
675:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
676:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
677:                                                .addPreferredGap(
678:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
679:                                                .add(
680:                                                        layout
681:                                                                .createParallelGroup(
682:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
683:                                                                .add(
684:                                                                        responseLabel)
685:                                                                .add(
686:                                                                        signResponseCB))
687:                                                .addPreferredGap(
688:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
689:                                                .add(certSettingsLabel)
690:                                                .addPreferredGap(
691:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
692:                                                .add(useDefaultKeyStoreCB)
693:                                                .addPreferredGap(
694:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
695:                                                .add(
696:                                                        layout
697:                                                                .createParallelGroup(
698:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
699:                                                                .add(
700:                                                                        keystoreLocationTF,
701:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
702:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
703:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
704:                                                                .add(
705:                                                                        browseButton)
706:                                                                .add(
707:                                                                        keystoreLocationLabel))
708:                                                .addPreferredGap(
709:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
710:                                                .add(
711:                                                        layout
712:                                                                .createParallelGroup(
713:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
714:                                                                .add(
715:                                                                        keystorePasswordLabel)
716:                                                                .add(
717:                                                                        keystorePasswordTF,
718:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
719:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
720:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
721:                                                .addPreferredGap(
722:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
723:                                                .add(
724:                                                        layout
725:                                                                .createParallelGroup(
726:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
727:                                                                .add(
728:                                                                        keyAliasLabel)
729:                                                                .add(
730:                                                                        keyAliasTF,
731:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
732:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
733:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
734:                                                .addPreferredGap(
735:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
736:                                                .add(
737:                                                        layout
738:                                                                .createParallelGroup(
739:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
740:                                                                .add(
741:                                                                        keyAliasPasswordLabel)
742:                                                                .add(
743:                                                                        keyPasswordTF,
744:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
745:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
746:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
747:                                                .add(11, 11, 11)
748:                                                .add(
749:                                                        jSeparator1,
750:                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
751:                                                        10,
752:                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
753:                                                .addPreferredGap(
754:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
755:                                                .add(
756:                                                        errorLabel,
757:                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
758:                                                        14,
759:                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
760:                                                .addContainerGap(
761:                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
762:                                                        Short.MAX_VALUE)));
763:            }// </editor-fold>//GEN-END:initComponents
764:
765:            private void formFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_formFocusGained
766:                // TODO add your handling code here:
767:                updateVisualState();
768:            }//GEN-LAST:event_formFocusGained
769:
770:            private void formAncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_formAncestorAdded
771:                // TODO add your handling code here:
772:                //requestFocusInWindow();
773:            }//GEN-LAST:event_formAncestorAdded
774:
775:            private void useDefaultKeyStoreCBActionPerformed(
776:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_useDefaultKeyStoreCBActionPerformed
777:                // TODO add your handling code here:
778:                updateVisualState();
779:            }//GEN-LAST:event_useDefaultKeyStoreCBActionPerformed
780:
781:            private void browseButtonActionPerformed(
782:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed
783:                // TODO add your handling code here:
784:                JFileChooser chooser = new JFileChooser();
785:
786:                chooser.setFileFilter(new FileFilter() {
787:
788:                    public boolean accept(File file) {
789:                        if (file.isFile()) {
790:                            if (file.getName().endsWith(JKS_EXTENSION)) {
791:                                return true;
792:                            } else {
793:                                return false;
794:                            }
795:                        }
796:
797:                        return true;
798:                    }
799:
800:                    public String getDescription() {
801:                        return NbBundle.getMessage(WSCSecurityPanel.class,
802:                                "TXT_JavaKeyStore");
803:                    }
804:                });
805:
806:                int returnVal = chooser.showOpenDialog(this );
807:
808:                if (returnVal == JFileChooser.APPROVE_OPTION) {
809:                    keystoreLocationTF.setText(chooser.getSelectedFile()
810:                            .getPath());
811:                }
812:            }//GEN-LAST:event_browseButtonActionPerformed
813:
814:            private void requestSecMechCBActionPerformed(
815:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_requestSecMechCBActionPerformed
816:                // TODO add your handling code here:
817:                updateVisualState();
818:
819:                if (isLiberty()) {
820:                    List<String> endpointURIs = helper.getEndpointURI();
821:                    int i = 0;
822:
823:                    for (ProviderConfigurator configurator : configurators) {
824:                        configurator.setValue(Configurable.SERVICE_TYPE, URN
825:                                + endpointURIs.get(i));
826:                        i++;
827:                    }
828:                } else {
829:                    for (ProviderConfigurator configurator : configurators) {
830:                        configurator.setValue(Configurable.SERVICE_TYPE, null);
831:                    }
832:                }
833:            }//GEN-LAST:event_requestSecMechCBActionPerformed
834:
835:            private void enableSecurityCBActionPerformed(
836:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_enableSecurityCBActionPerformed
837:                // TODO add your handling code here:
838:                if (enableSecurityCB.isSelected()) {
839:                    helper.setTransientState(true);
840:                } else {
841:                    helper.setTransientState(false);
842:                }
843:
844:                updateVisualState();
845:            }//GEN-LAST:event_enableSecurityCBActionPerformed
846:
847:            // Variables declaration - do not modify//GEN-BEGIN:variables
848:            private javax.swing.JButton browseButton;
849:            private javax.swing.JLabel certSettingsLabel;
850:            private javax.swing.JCheckBox enableSecurityCB;
851:            private javax.swing.JLabel errorLabel;
852:            private javax.swing.JSeparator jSeparator1;
853:            private javax.swing.JSeparator jSeparator2;
854:            private javax.swing.JLabel keyAliasLabel;
855:            private javax.swing.JLabel keyAliasPasswordLabel;
856:            private javax.swing.JTextField keyAliasTF;
857:            private javax.swing.JPasswordField keyPasswordTF;
858:            private javax.swing.JLabel keystoreLocationLabel;
859:            private javax.swing.JTextField keystoreLocationTF;
860:            private javax.swing.JLabel keystorePasswordLabel;
861:            private javax.swing.JPasswordField keystorePasswordTF;
862:            private javax.swing.JLabel passwordLabel;
863:            private javax.swing.JPasswordField passwordTF;
864:            private javax.swing.JLabel requestLabel;
865:            private javax.swing.JComboBox requestSecMechCB;
866:            private javax.swing.JLabel responseLabel;
867:            private javax.swing.JLabel secMechLabel;
868:            private javax.swing.JCheckBox signResponseCB;
869:            private javax.swing.JCheckBox useDefaultKeyStoreCB;
870:            private javax.swing.JLabel userNameLabel;
871:            private javax.swing.JTextField userNameTF;
872:            // End of variables declaration//GEN-END:variables
873:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.