-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SA-50 switch to HttpClient 4.1 for CalDAV integration
git-svn-id: https://source.jasig.org/sa/sched-assist/trunk@25908 f5dbab47-78f9-eb45-b975-e544023573eb
- Loading branch information
Showing
23 changed files
with
580 additions
and
260 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
261 changes: 159 additions & 102 deletions
261
...spi-caldav/src/main/java/org/jasig/schedassist/impl/caldav/CaldavCalendarDataDaoImpl.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...pi-caldav/src/main/java/org/jasig/schedassist/impl/caldav/CredentialsProviderFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* 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.schedassist.impl.caldav; | ||
|
||
import org.apache.http.client.CredentialsProvider; | ||
import org.jasig.schedassist.model.ICalendarAccount; | ||
|
||
/** | ||
* Factory interface for HTTP Client's {@link CredentialsProvider}s. | ||
* | ||
* @author Nicholas Blair | ||
* @version $Id: CredentialsProviderProvider.java $ | ||
*/ | ||
public interface CredentialsProviderFactory { | ||
|
||
/** | ||
* Return a {@link CredentialsProvider} that can be used when performing caldav operations against | ||
* the provided {@link ICalendarAccount}. | ||
* | ||
* Implementations may not all use the {@link ICalendarAccount}; some return the same set of | ||
* credentials for all inputs. | ||
* | ||
* @param account | ||
* @return a never null {@link CredentialsProvider} that the data dao can use to interact with the CalDAV server | ||
*/ | ||
CredentialsProvider getCredentialsProvider(ICalendarAccount account); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
...aldav/src/main/java/org/jasig/schedassist/impl/caldav/DefaultCredentialsProviderImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/** | ||
* 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.schedassist.impl.caldav; | ||
|
||
import org.apache.http.auth.AuthScope; | ||
import org.apache.http.auth.Credentials; | ||
import org.apache.http.client.CredentialsProvider; | ||
|
||
/** | ||
* This {@link CredentialsProvider} implementation will return the | ||
* supplied-at-construction-time {@link Credentials} if and only if | ||
* the request matches the configured {@link AuthScope}. | ||
* | ||
* @author Nicholas Blair | ||
* @version $Id: DefaultCredentialsProviderImpl.java $ | ||
*/ | ||
public class DefaultCredentialsProviderImpl implements CredentialsProvider { | ||
|
||
private final Credentials adminCredentials; | ||
private final AuthScope targetAuthScope; | ||
/** | ||
* | ||
* @param adminCredentials | ||
* @param targetAuthScope | ||
*/ | ||
public DefaultCredentialsProviderImpl(Credentials adminCredentials, | ||
AuthScope targetAuthScope) { | ||
this.adminCredentials = adminCredentials; | ||
this.targetAuthScope = targetAuthScope; | ||
} | ||
/** | ||
* @return the adminCredentials | ||
*/ | ||
public Credentials getAdminCredentials() { | ||
return adminCredentials; | ||
} | ||
/** | ||
* @return the targetAuthScope | ||
*/ | ||
public AuthScope getTargetAuthScope() { | ||
return targetAuthScope; | ||
} | ||
/* | ||
* (non-Javadoc) | ||
* @see org.apache.http.client.CredentialsProvider#clear() | ||
*/ | ||
@Override | ||
public void clear() { | ||
throw new UnsupportedOperationException("clear not supported"); | ||
} | ||
/* | ||
* (non-Javadoc) | ||
* @see org.apache.http.client.CredentialsProvider#getCredentials(org.apache.http.auth.AuthScope) | ||
*/ | ||
@Override | ||
public Credentials getCredentials(AuthScope authscope) { | ||
if(!targetAuthScope.equals(authscope)) { | ||
return null; | ||
} | ||
return adminCredentials; | ||
} | ||
/* | ||
* (non-Javadoc) | ||
* @see org.apache.http.client.CredentialsProvider#setCredentials(org.apache.http.auth.AuthScope, org.apache.http.auth.Credentials) | ||
*/ | ||
@Override | ||
public void setCredentials(AuthScope arg0, Credentials arg1) { | ||
throw new UnsupportedOperationException("setCredentials not supported"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.