1 23 24 29 30 package com.sun.enterprise.webservice; 31 import com.sun.enterprise.security.jauth.callback.*; 32 import javax.security.auth.callback.Callback ; 33 import javax.security.auth.callback.*; 34 import javax.security.auth.callback.UnsupportedCallbackException ; 35 import java.io.IOException ; 36 import java.util.logging.*; 37 import com.sun.enterprise.security.wss.*; 38 39 43 public final class EjbServletWSSCallbackHandler extends WSSCallbackHandler{ 44 private static WSSCallbackHandler INSTANCE = null; 45 46 47 private EjbServletWSSCallbackHandler() { 48 } 49 52 static WSSCallbackHandler newInstance() { 53 if(INSTANCE == null){ 54 INSTANCE = new EjbServletWSSCallbackHandler(); 55 } 56 return INSTANCE; 57 } 58 59 60 public void handle(Callback [] callbacks) 61 throws IOException , UnsupportedCallbackException 62 { 63 if(callbacks == null){ 64 return; 65 } 66 for (int i=0; i<callbacks.length; i++){ 67 if(!isSupportedCallback(callbacks[i])){ 68 _logger.log(Level.FINE, "wss-container-auth: UnsupportedCallback : "+ 69 callbacks[i].getClass().getName()); 70 throw new UnsupportedCallbackException (callbacks[i]); 71 } 72 processCallback(callbacks[i]); 73 } 74 } 75 boolean isSupportedCallback(Callback callback) { 76 boolean isSupported = false; 77 if (callback instanceof CertStoreCallback){ 78 isSupported = true; 79 } else if(callback instanceof PasswordValidationCallback){ 80 isSupported = true; 81 } else if (callback instanceof SecretKeyCallback){ 82 isSupported = true; 83 } else if (callback instanceof PrivateKeyCallback){ 84 isSupported = true; 85 } else if (callback instanceof TrustStoreCallback){ 86 isSupported = true; 87 } else{ 88 isSupported = false; 89 } 90 return isSupported; 91 } 92 93 } 94 | Popular Tags |