1 13 package info.magnolia.cms.security.auth; 14 15 import org.apache.commons.codec.binary.Base64; 16 import org.apache.commons.lang.StringUtils; 17 18 19 23 public class Base64CallbackHandler extends CredentialsCallbackHandler { 24 25 28 public Base64CallbackHandler() { 29 } 31 32 35 public Base64CallbackHandler(String credentials) { 36 credentials = getDecodedCredentials(credentials.substring(6).trim()); 37 this.name = StringUtils.substringBefore(credentials, ":"); 38 this.pswd = StringUtils.substringAfter(credentials, ":").toCharArray(); 39 } 40 41 45 private static String getDecodedCredentials(String credentials) { 46 return (new String (Base64.decodeBase64(credentials.getBytes()))); 47 } 48 49 } 50 | Popular Tags |