Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Licensed to Jasig under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. Jasig licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 
 package org.jasig.cas3.extensions.clearpass.integration.uportal;
 

Author(s):
Scott Battaglia
Version:
$Revision$ $Date$
Since:
1.0.0.GA
 
 
     private final String clearPassUrl;
 
     private byte[] cachedCredentials;
 
     protected PasswordCachingCasAssertionSecurityContext(final String clearPassUrl) {
         super();
         Assert.notNull(clearPassUrl"clearPassUrl cannot be null.");
         this. = clearPassUrl;
     }
 
     @Override
     protected void postAuthenticate(final Assertion assertion) {
         final String proxyTicket = assertion.getPrincipal().getProxyTicketFor(this.);
 
         if (proxyTicket == null) {
             .error("Unable to obtain proxy ticket for ClearPass service.");
             return;
         }
 
         final String password = retrievePasswordFromResponse(proxyTicket);
 
         if (password != null) {
             .debug("Password retrieved from ClearPass.");
             this. = password.getBytes();
         } else {
             .debug("Unable to retrieve password from ClearPass.");
         }
     }
 
     @Override
         if (this. == null) {
             return super.getOpaqueCredentials();
         }
 
         final NotSoOpaqueCredentials credentials = new CacheOpaqueCredentials();
         credentials.setCredentials(this.);
         return credentials;
     }
 
     protected final String retrievePasswordFromResponse(final String proxyTicket) {
         final String url = this. + (this..contains("?") ? "&" : "?") + "ticket=" + proxyTicket;
         final String response = CommonUtils.getResponseFromServer(url"UTF-8");
         final String password = XmlUtils.getTextForElement(response"credentials");
 
 
         if (.isTraceEnabled()) {
             .trace(String.format("ClearPass Response was:\n %s"response));
         }
 
         if (CommonUtils.isNotBlank(password)) {
             return password;
         }
 
         .error("Unable to Retrieve Password.  Full Response from ClearPass was [" + response + "]");
         return null;
     }


    
Copied from org.jasig.portal.security.provider.CacheSecurityContext
 
		private static final long serialVersionUID = 1l;
		public String getCredentials() {
            return this. != null ? new String(this.) : null;
		}
	}
New to GrepCode? Check out our FAQ X