1 23 package com.sun.enterprise.deployment; 24 25 26 import com.sun.enterprise.deployment.web.LoginConfiguration; 27 import com.sun.enterprise.util.LocalStringManagerImpl; 28 29 import java.util.logging.*; 31 import com.sun.enterprise.deployment.util.LogDomains; 32 34 35 39 40 public class LoginConfigurationImpl extends Descriptor implements LoginConfiguration { 41 42 public static final String AUTHENTICATION_METHOD_BASIC = LoginConfiguration.BASIC_AUTHENTICATION; 43 44 public static final String AUTHENTICATION_METHOD_DIGEST = LoginConfiguration.DIGEST_AUTHENTICATION; 45 46 public static final String AUTHENTICATION_METHOD_FORM = LoginConfiguration.FORM_AUTHENTICATION; 47 48 public static final String AUTHENTICATION_METHOD_CLIENT_CERTIFICATE = LoginConfiguration.CLIENT_CERTIFICATION_AUTHENTICATION; 49 50 static Logger _logger = LogDomains.getLogger(LogDomains.DPL_LOGGER); 52 54 private String authenticationMethod; 55 private String realmName = ""; 56 private String formLoginPage = ""; 57 private String formErrorPage = ""; 58 private static LocalStringManagerImpl localStrings = 59 new LocalStringManagerImpl(LoginConfigurationImpl.class); 60 61 62 public String getAuthenticationMethod() { 63 if (this.authenticationMethod == null) { 64 _logger.log(Level.WARNING,"enterprise.deployment_no_auth_method_dfnd"); 66 this.authenticationMethod = AUTHENTICATION_METHOD_BASIC; 68 } 69 return this.authenticationMethod; 70 } 71 72 73 public void setAuthenticationMethod(String authenticationMethod) { 74 75 if ( this.isBoundsChecking() ) { 76 77 if (!LoginConfiguration.BASIC_AUTHENTICATION.equals(authenticationMethod) 78 && !LoginConfiguration.DIGEST_AUTHENTICATION.equals(authenticationMethod) 79 && !LoginConfiguration.FORM_AUTHENTICATION.equals(authenticationMethod) 80 && !LoginConfiguration.CLIENT_CERTIFICATION_AUTHENTICATION.equals(authenticationMethod) ) { 81 82 throw new IllegalArgumentException (localStrings.getLocalString( 83 "enterprise.deployment..exceptionauthenticationmethod", 84 "{0} is not a valid authentication method", new Object [] {authenticationMethod})); 85 86 } 87 } 88 this.authenticationMethod = authenticationMethod; 89 90 } 91 92 93 public String getRealmName() { 94 if (this.realmName == null) { 95 this.realmName = ""; 96 } 97 return this.realmName; 98 } 99 100 101 public void setRealmName(String realmName) { 102 this.realmName = realmName; 103 } 104 105 106 public String getFormLoginPage() { 107 if (this.formLoginPage == null) { 108 this.formLoginPage = ""; 109 } 110 return this.formLoginPage; 111 } 112 113 public void setFormLoginPage(String formLoginPage) { 114 this.formLoginPage = formLoginPage; 115 } 116 117 118 public String getFormErrorPage() { 119 if (this.formErrorPage == null) { 120 this.formErrorPage = ""; 121 } 122 return this.formErrorPage; 123 } 124 125 public void setFormErrorPage(String formErrorPage) { 126 this.formErrorPage = formErrorPage; 127 } 128 129 public void print(StringBuffer toStringBuffer) { 130 toStringBuffer.append("LoginConfig:(").append(authenticationMethod).append(" ").append( 131 realmName).append(" ").append(formLoginPage).append(" ").append(formErrorPage).append(")"); 132 } 133 134 } 135 | Popular Tags |