當前位置: 首頁>>代碼示例>>Java>>正文


Java BaseCredentialsInfo類代碼示例

本文整理匯總了Java中org.alfresco.service.cmr.remotecredentials.BaseCredentialsInfo的典型用法代碼示例。如果您正苦於以下問題:Java BaseCredentialsInfo類的具體用法?Java BaseCredentialsInfo怎麽用?Java BaseCredentialsInfo使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BaseCredentialsInfo類屬於org.alfresco.service.cmr.remotecredentials包,在下文中一共展示了BaseCredentialsInfo類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: deleteCredentials

import org.alfresco.service.cmr.remotecredentials.BaseCredentialsInfo; //導入依賴的package包/類
@Override
public void deleteCredentials(BaseCredentialsInfo credentialsInfo)
{
    if (credentialsInfo.getNodeRef() == null)
    {
        throw new IllegalArgumentException("Cannot delete Credentials which haven't been persisted yet!");
    }
    nodeService.deleteNode(credentialsInfo.getNodeRef());
    
    if (logger.isDebugEnabled())
        logger.debug("Deleted credentials " + credentialsInfo + " from " + credentialsInfo.getNodeRef() + 
                     " from Remote System " + credentialsInfo.getRemoteSystemName());
    
    // Leave the Remote System Container, in case special permissions
    //  were previously applied to it that should be retained
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:17,代碼來源:RemoteCredentialsServiceImpl.java

示例2: getPersonCredentials

import org.alfresco.service.cmr.remotecredentials.BaseCredentialsInfo; //導入依賴的package包/類
@Override
public BaseCredentialsInfo getPersonCredentials(String remoteSystem)
{
    NodeRef personContainer = getPersonContainer(remoteSystem, false);
    if (personContainer == null) return null;

    // Grab the children
    List<ChildAssociationRef> credentials = 
        nodeService.getChildAssocs(personContainer, RemoteCredentialsModel.ASSOC_CREDENTIALS, RegexQNamePattern.MATCH_ALL);
    if (credentials.size() > 0)
    {
        NodeRef nodeRef = credentials.get(0).getChildRef();
        return loadCredentials(remoteSystem, personContainer, nodeRef);
    }
    return null;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:17,代碼來源:RemoteCredentialsServiceImpl.java

示例3: loadCredentials

import org.alfresco.service.cmr.remotecredentials.BaseCredentialsInfo; //導入依賴的package包/類
private BaseCredentialsInfo loadCredentials(String remoteSystem, NodeRef remoteSystemNodeRef, NodeRef credentialsNodeRef)
{
    QName type = nodeService.getType(credentialsNodeRef);
    RemoteCredentialsInfoFactory factory = credentialsFactories.get(type);
    if (factory == null)
    {
        throw new TypeConversionException("No Factory registered for type " + type);
    }
    
    // Wrap as an object
    return factory.createCredentials(
            type, credentialsNodeRef,
            remoteSystem, remoteSystemNodeRef,
            nodeService.getProperties(credentialsNodeRef)
    );
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:17,代碼來源:RemoteCredentialsServiceImpl.java

示例4: serializeCredentials

import org.alfresco.service.cmr.remotecredentials.BaseCredentialsInfo; //導入依賴的package包/類
/**
 * Serializes the given {@link BaseCredentialsInfo} object to node properties.
 * 
 * @param info The Credentials object to serialize
 * @return The final set of properties to be serialized for the node
 */
public Map<QName,Serializable> serializeCredentials(BaseCredentialsInfo info)
{
    if (! (info instanceof PasswordCredentialsInfo))
    {
        throw new IllegalStateException("Incorrect registration, info must be a PasswordCredentialsInfo");
    }
    
    // Encrypt the password
    PasswordCredentialsInfo credentials = (PasswordCredentialsInfo)info;
    Serializable passwordEncrypted = metadataEncryptor.encrypt(
            RemoteCredentialsModel.PROP_REMOTE_PASSWORD, credentials.getRemotePassword());

    // Store our specific types and return
    Map<QName,Serializable> properties = new HashMap<QName, Serializable>();
    properties.put(RemoteCredentialsModel.PROP_REMOTE_PASSWORD, passwordEncrypted);
    return properties;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:24,代碼來源:PasswordCredentialsFactory.java

示例5: serializeCredentials

import org.alfresco.service.cmr.remotecredentials.BaseCredentialsInfo; //導入依賴的package包/類
/**
 * Serializes the given {@link BaseCredentialsInfo} object to node properties.
 * 
 * @param info The Credentials object to serialize
 * @return The final set of properties to be serialized for the node
 */
public Map<QName,Serializable> serializeCredentials(BaseCredentialsInfo info)
{
    if (! (info instanceof OAuth2CredentialsInfo))
    {
        throw new IllegalStateException("Incorrect registration, info must be a OAuth2CredentialsInfo");
    }
    
    // Encrypt the token details
    OAuth2CredentialsInfo credentials = (OAuth2CredentialsInfo)info;
    
    Serializable accessTokenEncrypted = metadataEncryptor.encrypt(
            RemoteCredentialsModel.PROP_OAUTH2_ACCESS_TOKEN, credentials.getOAuthAccessToken());
    Serializable refreshTokenEncrypted = metadataEncryptor.encrypt(
            RemoteCredentialsModel.PROP_OAUTH2_REFRESH_TOKEN, credentials.getOAuthRefreshToken());

    // Store our specific types and return
    Map<QName,Serializable> properties = new HashMap<QName, Serializable>();
    properties.put(RemoteCredentialsModel.PROP_OAUTH2_ACCESS_TOKEN, accessTokenEncrypted);
    properties.put(RemoteCredentialsModel.PROP_OAUTH2_REFRESH_TOKEN, refreshTokenEncrypted);
    properties.put(RemoteCredentialsModel.PROP_OAUTH2_TOKEN_ISSUED_AT, credentials.getOAuthTicketIssuedAt());
    properties.put(RemoteCredentialsModel.PROP_OAUTH2_TOKEN_EXPIRES_AT, credentials.getOAuthTicketExpiresAt());
    return properties;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:30,代碼來源:OAuth2CredentialsFactory.java

示例6: serializeCredentials

import org.alfresco.service.cmr.remotecredentials.BaseCredentialsInfo; //導入依賴的package包/類
/**
 * Serializes the given {@link BaseCredentialsInfo} object to node properties.
 * 
 * @param info The Credentials object to serialize
 * @return The final set of properties to be serialized for the node
 */
public Map<QName,Serializable> serializeCredentials(BaseCredentialsInfo info)
{
    if (! (info instanceof OAuth1CredentialsInfo))
    {
        throw new IllegalStateException("Incorrect registration, info must be a OAuth1CredentialsInfo");
    }
    
    // Encrypt the details
    OAuth1CredentialsInfo credentials = (OAuth1CredentialsInfo)info;
    
    Serializable tokenEncrypted = metadataEncryptor.encrypt(
            RemoteCredentialsModel.PROP_OAUTH1_TOKEN, credentials.getOAuthToken());
    Serializable secretEncrypted = metadataEncryptor.encrypt(
            RemoteCredentialsModel.PROP_OAUTH1_TOKEN_SECRET, credentials.getOAuthSecret());

    // Store our specific types and return
    Map<QName,Serializable> properties = new HashMap<QName, Serializable>();
    properties.put(RemoteCredentialsModel.PROP_OAUTH1_TOKEN, tokenEncrypted);
    properties.put(RemoteCredentialsModel.PROP_OAUTH1_TOKEN_SECRET, secretEncrypted);
    return properties;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:28,代碼來源:OAuth1CredentialsFactory.java

示例7: createCredentials

import org.alfresco.service.cmr.remotecredentials.BaseCredentialsInfo; //導入依賴的package包/類
private BaseCredentialsInfo createCredentials(String remoteSystem, NodeRef remoteSystemNodeRef, BaseCredentialsInfo credentials)
{
    if (credentials.getNodeRef() != null)
    {
        throw new IllegalArgumentException("Cannot create Credentials which have already been persisted!");
    }
    
    // Check we know about the type
    RemoteCredentialsInfoFactory factory = credentialsFactories.get(credentials.getCredentialsType());
    if (factory == null)
    {
        throw new TypeConversionException("No Factory registered for type " + credentials.getCredentialsType());
    }
    
    // Build the properties
    Map<QName,Serializable> properties = RemoteCredentialsInfoFactory.FactoryHelper.getCoreCredentials(credentials);
    properties.putAll( factory.serializeCredentials(credentials) );
    
    // Generate a name for it, which will be unique and doesn't need updating
    QName name = QName.createQName(GUID.generate()); 
    
    // Add the node
    NodeRef nodeRef = nodeService.createNode(
            remoteSystemNodeRef, RemoteCredentialsModel.ASSOC_CREDENTIALS,
            name, credentials.getCredentialsType(), properties
    ).getChildRef();
    
    if (logger.isDebugEnabled())
        logger.debug("Created new credentials at " + nodeRef + " for " + remoteSystem + " in " + 
                     remoteSystemNodeRef + " of " + credentials);
    
    // Return the new object
    return factory.createCredentials(
            credentials.getCredentialsType(), nodeRef,
            remoteSystem, remoteSystemNodeRef,
            nodeService.getProperties(nodeRef)
    );
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:39,代碼來源:RemoteCredentialsServiceImpl.java

示例8: updateCredentials

import org.alfresco.service.cmr.remotecredentials.BaseCredentialsInfo; //導入依賴的package包/類
@Override
public BaseCredentialsInfo updateCredentials(BaseCredentialsInfo credentials)
{
    if (credentials.getNodeRef() == null)
    {
        throw new IllegalArgumentException("Cannot update Credentials which haven't been persisted yet!");
    }
    
    RemoteCredentialsInfoFactory factory = credentialsFactories.get(credentials.getCredentialsType());
    if (factory == null)
    {
        throw new TypeConversionException("No Factory registered for type " + credentials.getCredentialsType());
    }
    
    // Grab the current set of properties
    Map<QName,Serializable> oldProps = nodeService.getProperties(credentials.getNodeRef());
    
    // Overwrite them with the credentials ones
    Map<QName,Serializable> props = new HashMap<QName,Serializable>(oldProps);
    props.putAll( RemoteCredentialsInfoFactory.FactoryHelper.getCoreCredentials(credentials) );
    props.putAll( factory.serializeCredentials(credentials) );
    
    // Store
    nodeService.setProperties(credentials.getNodeRef(), props);
    
    // For now, return as-is
    return credentials;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:29,代碼來源:RemoteCredentialsServiceImpl.java

示例9: updateCredentialsAuthenticationSucceeded

import org.alfresco.service.cmr.remotecredentials.BaseCredentialsInfo; //導入依賴的package包/類
@Override
public BaseCredentialsInfo updateCredentialsAuthenticationSucceeded(boolean succeeded, BaseCredentialsInfo credentials)
{
    // We can't help with credentials that have never been stored
    if (credentials.getNodeRef() == null)
    {
        throw new IllegalArgumentException("Cannot update Credentials which haven't been persisted yet!");
    }
    
    // Return quickly if the credentials are already in the correct state 
    if (succeeded == credentials.getLastAuthenticationSucceeded())
    {
        return credentials;
    }

    
    // Do the update 
    nodeService.setProperty(credentials.getNodeRef(), RemoteCredentialsModel.PROP_LAST_AUTHENTICATION_SUCCEEDED, succeeded);
    
    // Update the object if we can
    if (credentials instanceof AbstractCredentialsImpl)
    {
        ((AbstractCredentialsImpl)credentials).setLastAuthenticationSucceeded(succeeded);
        return credentials;
    }
    else
    {
        // Need to re-load
        return loadCredentials(credentials.getRemoteSystemName(),
                credentials.getRemoteSystemContainerNodeRef(), credentials.getNodeRef());
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:33,代碼來源:RemoteCredentialsServiceImpl.java

示例10: listSharedCredentials

import org.alfresco.service.cmr.remotecredentials.BaseCredentialsInfo; //導入依賴的package包/類
@Override
public PagingResults<? extends BaseCredentialsInfo> listSharedCredentials(String remoteSystem,
        QName credentialsType, PagingRequest paging)
{
    // Get the container for that system
    NodeRef container = getSharedContainer(remoteSystem, false);
    if (container == null)
    {
        return new EmptyPagingResults<BaseCredentialsInfo>();
    }
    return listCredentials(new NodeRef[] {container}, remoteSystem, credentialsType, paging);
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:13,代碼來源:RemoteCredentialsServiceImpl.java

示例11: listPersonCredentials

import org.alfresco.service.cmr.remotecredentials.BaseCredentialsInfo; //導入依賴的package包/類
@Override
public PagingResults<? extends BaseCredentialsInfo> listPersonCredentials(String remoteSystem,
        QName credentialsType, PagingRequest paging)
{
    // Get the container for that system
    NodeRef container = getPersonContainer(remoteSystem, false);
    if (container == null)
    {
        return new EmptyPagingResults<BaseCredentialsInfo>();
    }
    return listCredentials(new NodeRef[] {container}, remoteSystem, credentialsType, paging);
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:13,代碼來源:RemoteCredentialsServiceImpl.java

示例12: listAllCredentials

import org.alfresco.service.cmr.remotecredentials.BaseCredentialsInfo; //導入依賴的package包/類
@Override
public PagingResults<? extends BaseCredentialsInfo> listAllCredentials(String remoteSystem, QName credentialsType,
        PagingRequest paging)
{
    NodeRef personContainer = getPersonContainer(remoteSystem, false);
    NodeRef systemContainer = getSharedContainer(remoteSystem, false);
    if (personContainer == null && systemContainer == null)
    {
        return new EmptyPagingResults<BaseCredentialsInfo>();
    }
    return listCredentials(new NodeRef[] {personContainer, systemContainer}, remoteSystem, credentialsType, paging);
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:13,代碼來源:RemoteCredentialsServiceImpl.java

示例13: CredentialsPagingResults

import org.alfresco.service.cmr.remotecredentials.BaseCredentialsInfo; //導入依賴的package包/類
private CredentialsPagingResults(List<ChildAssociationRef> refs, int size, boolean hasMore, String remoteSystem)
{
    this.size = size;
    this.hasMore = hasMore; 
    
    this.results = new ArrayList<BaseCredentialsInfo>(refs.size());
    for (ChildAssociationRef ref : refs)
    {
        this.results.add( loadCredentials(remoteSystem, ref.getParentRef(), ref.getChildRef()) );
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:12,代碼來源:RemoteCredentialsServiceImpl.java

示例14: getCoreCredentials

import org.alfresco.service.cmr.remotecredentials.BaseCredentialsInfo; //導入依賴的package包/類
/**
 * Generates the core properties for a {@link BaseCredentialsInfo}
 */
public static Map<QName,Serializable> getCoreCredentials(BaseCredentialsInfo credentials)
{
    Map<QName,Serializable> properties = new HashMap<QName, Serializable>();
    properties.put(RemoteCredentialsModel.PROP_REMOTE_USERNAME, credentials.getRemoteUsername());
    properties.put(RemoteCredentialsModel.PROP_LAST_AUTHENTICATION_SUCCEEDED, credentials.getLastAuthenticationSucceeded());
    return properties;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:11,代碼來源:RemoteCredentialsInfoFactory.java

示例15: ensureCredentialsFound

import org.alfresco.service.cmr.remotecredentials.BaseCredentialsInfo; //導入依賴的package包/類
protected PasswordCredentialsInfo ensureCredentialsFound(String remoteSystemId, BaseCredentialsInfo credentails)
{
    // Check they exist, and are of the right type
    if (credentails == null)
    {
        throw new NoCredentialsFoundException(remoteSystemId);
    }
    if (! (credentails instanceof PasswordCredentialsInfo))
    {
        throw new AlfrescoRuntimeException("Credentials found, but of the wrong type, needed PasswordCredentialsInfo but got " + credentails); 
    }
    return (PasswordCredentialsInfo)credentails;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:14,代碼來源:RemoteAlfrescoTicketServiceImpl.java


注:本文中的org.alfresco.service.cmr.remotecredentials.BaseCredentialsInfo類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。