本文整理汇总了Java中org.alfresco.repo.security.authentication.AuthenticationException类的典型用法代码示例。如果您正苦于以下问题:Java AuthenticationException类的具体用法?Java AuthenticationException怎么用?Java AuthenticationException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AuthenticationException类属于org.alfresco.repo.security.authentication包,在下文中一共展示了AuthenticationException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: doExecuteJSONRequest
import org.alfresco.repo.security.authentication.AuthenticationException; //导入依赖的package包/类
public static JSONObject doExecuteJSONRequest(RemoteConnectorRequest request, RemoteConnectorService service) throws ParseException, IOException, AuthenticationException
{
// Set as JSON
request.setContentType(MimetypeMap.MIMETYPE_JSON);
// Perform the request
RemoteConnectorResponse response = service.executeRequest(request);
// Parse this as JSON
JSONParser parser = new JSONParser();
String jsonText = response.getResponseBodyAsString();
Object json = parser.parse(jsonText);
// Check it's the right type and return
if (json instanceof JSONObject)
{
return (JSONObject)json;
}
else
{
throw new ParseException(0, json);
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:RemoteConnectorServiceImpl.java
示例2: test
import org.alfresco.repo.security.authentication.AuthenticationException; //导入依赖的package包/类
/**
* The login method.
*
*/
public boolean test(String userid, String password)
{
try
{
authenticationService.authenticate(userid, password.toCharArray());
String email = null;
if (personService.personExists(userid))
{
NodeRef personNodeRef = personService.getPerson(userid);
email = (String) nodeService.getProperty(personNodeRef, ContentModel.PROP_EMAIL);
}
GreenMailUser user = new AlfrescoImapUser(email, userid, password);
addUser(user);
}
catch (AuthenticationException ex)
{
logger.error("IMAP authentication failed for userid: " + userid);
return false;
}
return true;
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:AlfrescoImapUserManager.java
示例3: enableTenant
import org.alfresco.repo.security.authentication.AuthenticationException; //导入依赖的package包/类
@Override
public void enableTenant(String tenantDomain)
{
tenantDomain = getTenantDomain(tenantDomain);
if (! existsTenant(tenantDomain))
{
throw new AuthenticationException("Tenant does not exist: " + tenantDomain);
}
if (isEnabledTenant(tenantDomain))
{
logger.warn("Tenant already enabled: " + tenantDomain);
}
TenantUpdateEntity tenantUpdateEntity = tenantAdminDAO.getTenantForUpdate(tenantDomain);
tenantUpdateEntity.setEnabled(true);
tenantAdminDAO.updateTenant(tenantUpdateEntity);
notifyAfterEnableTenant(tenantDomain);
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:MultiTAdminServiceImpl.java
示例4: disableTenant
import org.alfresco.repo.security.authentication.AuthenticationException; //导入依赖的package包/类
@Override
public void disableTenant(String tenantDomain)
{
tenantDomain = getTenantDomain(tenantDomain);
if (! existsTenant(tenantDomain))
{
throw new AuthenticationException("Tenant does not exist: " + tenantDomain);
}
if (! isEnabledTenant(tenantDomain))
{
logger.warn("Tenant already disabled: " + tenantDomain);
}
notifyBeforeDisableTenant(tenantDomain);
// update tenant attributes / tenant cache - need to disable after notifying listeners (else they cannot disable)
TenantUpdateEntity tenantUpdateEntity = tenantAdminDAO.getTenantForUpdate(tenantDomain);
tenantUpdateEntity.setEnabled(false);
tenantAdminDAO.updateTenant(tenantUpdateEntity);
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:23,代码来源:MultiTAdminServiceImpl.java
示例5: isTicketValid
import org.alfresco.repo.security.authentication.AuthenticationException; //导入依赖的package包/类
/**
* Checks if a user ticket is still valid
*
* @return {@link Boolean} value: <code>true</code> if the ticket is still valid, <code>false</code> if the ticket is not valid any more
*/
private boolean isTicketValid()
{
try
{
authenticationService.validate(ticket);
return true;
}
catch (AuthenticationException e)
{
if (logger.isDebugEnabled())
{
logger.debug("User ticket is not valid. Passing to the Basic authentication handling. Reqeust information:\n"
+ " ticket: " + ticket + "\n"
+ " request: " + servletReq.getQueryString() + "\n"
+ " error: " + e, e);
}
return false;
}
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:26,代码来源:BasicHttpAuthenticatorFactory.java
示例6: login
import org.alfresco.repo.security.authentication.AuthenticationException; //导入依赖的package包/类
protected Map<String, Object> login(final String username, String password)
{
try
{
// get ticket
authenticationService.authenticate(username, password.toCharArray());
eventPublisher.publishEvent(new EventPreparator(){
@Override
public Event prepareEvent(String user, String networkId, String transactionId)
{
// TODO need to fix up to pass correct seqNo and alfrescoClientId
return new RepositoryEventImpl(-1l, "login", transactionId, networkId, new Date().getTime(),
username, null);
}
});
// add ticket to model for javascript and template access
Map<String, Object> model = new HashMap<String, Object>(7, 1.0f);
model.put("username", username);
model.put("ticket", authenticationService.getCurrentTicket());
return model;
}
catch(AuthenticationException e)
{
throw new WebScriptException(HttpServletResponse.SC_FORBIDDEN, "Login failed");
}
finally
{
AuthenticationUtil.clearCurrentSecurityContext();
}
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:34,代码来源:AbstractLoginBean.java
示例7: createTicket
import org.alfresco.repo.security.authentication.AuthenticationException; //导入依赖的package包/类
@Override
public LoginTicketResponse createTicket(LoginTicket loginRequest, Parameters parameters)
{
validateLoginRequest(loginRequest);
try
{
// get ticket
authenticationService.authenticate(loginRequest.getUserId(), loginRequest.getPassword().toCharArray());
LoginTicketResponse response = new LoginTicketResponse();
response.setUserId(loginRequest.getUserId());
response.setId(authenticationService.getCurrentTicket());
return response;
}
catch (AuthenticationException e)
{
throw new PermissionDeniedException("Login failed");
}
finally
{
AuthenticationUtil.clearCurrentSecurityContext();
}
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:25,代码来源:AuthenticationsImpl.java
示例8: loginWithFailure
import org.alfresco.repo.security.authentication.AuthenticationException; //导入依赖的package包/类
/**
* Perform a failed login attempt
*/
private void loginWithFailure(final String username) throws Exception
{
// Force a failed login
RunAsWork<Void> failureWork = new RunAsWork<Void>()
{
@Override
public Void doWork() throws Exception
{
try
{
authenticationService.authenticate(username, "crud".toCharArray());
fail("Failed to force authentication failure");
}
catch (AuthenticationException e)
{
// Expected
}
return null;
}
};
AuthenticationUtil.runAs(failureWork, AuthenticationUtil.getSystemUserName());
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:26,代码来源:AuditWebScriptTest.java
示例9: addUserDescription
import org.alfresco.repo.security.authentication.AuthenticationException; //导入依赖的package包/类
public NodeRef addUserDescription(final String personId, final TestNetwork network, final String personDescription)
{
return AuthenticationUtil.runAsSystem(new RunAsWork<NodeRef>()
{
//@Override
public NodeRef doWork() throws Exception
{
NodeRef userRef = personService.getPersonOrNull(personId);
if (userRef == null)
{
throw new AuthenticationException("User name does not exist: " + personId);
}
ContentWriter writer = contentService.getWriter(userRef, ContentModel.PROP_PERSONDESC, true);
writer.setMimetype(MimetypeMap.MIMETYPE_HTML);
writer.putContent(personDescription);
log("Updated person description " + personId + (network != null ? " in network " + network : ""));
return userRef;
}
});
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:23,代码来源:RepoService.java
示例10: login
import org.alfresco.repo.security.authentication.AuthenticationException; //导入依赖的package包/类
/**
* Perform a login attempt (to be used to create audit entries)
*/
private void login(final String username, final String password) throws Exception
{
// Force a failed login
RunAsWork<Void> failureWork = new RunAsWork<Void>()
{
@Override
public Void doWork() throws Exception
{
try
{
authenticationService.authenticate(username, password.toCharArray());
fail("Failed to force authentication failure");
}
catch (AuthenticationException e)
{
// Expected
}
return null;
}
};
AuthenticationUtil.runAs(failureWork, AuthenticationUtil.getSystemUserName());
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:26,代码来源:AuditAppTest.java
示例11: authenticateImpl
import org.alfresco.repo.security.authentication.AuthenticationException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void authenticateImpl(final String userName, final char[] password) throws AuthenticationException
{
String baseUserName;
final Pair<String, String> userTenant = AuthenticationUtil.getUserTenant(userName);
final String tenantDomain = userTenant.getSecond();
if (this.stripTenantDomainForAuthentication && EqualsHelper.nullSafeEquals(this.tenantDomain, tenantDomain))
{
baseUserName = this.tenantService.getBaseNameUser(userName);
}
else
{
baseUserName = userName;
}
super.authenticateImpl(baseUserName, password);
}
开发者ID:Acosix,项目名称:alfresco-mt-support,代码行数:22,代码来源:TenantAwareLDAPAuthenticationComponent.java
示例12: setCurrentUser
import org.alfresco.repo.security.authentication.AuthenticationException; //导入依赖的package包/类
@Override
public Authentication setCurrentUser(final String authenticatedUserName) throws AuthenticationException
{
String domainUser = authenticatedUserName;
if (!EqualsHelper.nullSafeEquals(this.tenantDomain, TenantUtil.DEFAULT_TENANT))
{
TenantContextHolder.setTenantDomain(this.tenantDomain);
final String domain = this.tenantService.getDomain(authenticatedUserName);
if (!EqualsHelper.nullSafeEquals(domain, this.tenantDomain))
{
domainUser = this.tenantService.getDomainUser(authenticatedUserName, this.tenantDomain);
}
}
final Authentication authentication = super.setCurrentUser(domainUser);
return authentication;
}
开发者ID:Acosix,项目名称:alfresco-mt-support,代码行数:19,代码来源:TenantAwareLDAPAuthenticationComponent.java
示例13: getUserHomeLocation
import org.alfresco.repo.security.authentication.AuthenticationException; //导入依赖的package包/类
/**
* Get home space for current user
*
* @return String url to home space
*/
public String getUserHomeLocation()
{
NodeRef currentUser = personService.getPerson(authenticationComponent.getCurrentUserName());
if (currentUser == null)
{
throw new AuthenticationException("No user have been authorized.");
}
NodeRef homeSpace = (NodeRef) nodeService.getProperty(currentUser, ContentModel.PROP_HOMEFOLDER);
if (homeSpace == null)
{
throw new RuntimeException("No home space was found.");
}
return toUrlPath(fileFolderService.getFileInfo(homeSpace));
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:24,代码来源:VtiPathHelper.java
示例14: normalizeUserId
import org.alfresco.repo.security.authentication.AuthenticationException; //导入依赖的package包/类
private String normalizeUserId(String externalUserId) throws SMBSrvException
{
try
{
return mapUserNameToPerson(externalUserId, true);
}
catch (AuthenticationException e)
{
// Invalid user. Return a logon failure status
logger.debug("Authentication Exception", e);
throw new SMBSrvException(SMBStatus.NTLogonFailure, SMBStatus.ErrDos, SMBStatus.DOSAccessDenied);
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:14,代码来源:EnterpriseCifsAuthenticator.java
示例15: authenticateUserNamePassword
import org.alfresco.repo.security.authentication.AuthenticationException; //导入依赖的package包/类
/**
* authenticate with a user/password
* @param userName
* @param password
* @return true - authenticated
*/
protected boolean authenticateUserNamePassword(String userName, char[] password)
{
try
{
getAuthenticationComponent().authenticate(userName, password);
return true;
}
catch (AuthenticationException e)
{
return false;
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:19,代码来源:EmailServer.java
示例16: getInitialDirContext
import org.alfresco.repo.security.authentication.AuthenticationException; //导入依赖的package包/类
@Override
public InitialDirContext getInitialDirContext(String principal,
String credentials)
throws AuthenticationException
{
return getInitialDirContext(principal, credentials, null);
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:8,代码来源:LDAPInitialDirContextFactoryImpl.java
示例17: invalidateTasksByUser
import org.alfresco.repo.security.authentication.AuthenticationException; //导入依赖的package包/类
private void invalidateTasksByUser(String userName) throws AuthenticationException
{
List<Invitation> listForInvitee = listPendingInvitationsForInvitee(userName);
for (Invitation inv : listForInvitee)
{
cancel(inv.getInviteId());
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:9,代码来源:InvitationServiceImpl.java
示例18: getTenant
import org.alfresco.repo.security.authentication.AuthenticationException; //导入依赖的package包/类
@Override
public Tenant getTenant(String tenantDomain)
{
tenantDomain = getTenantDomain(tenantDomain);
if (! existsTenant(tenantDomain))
{
throw new AuthenticationException("Tenant does not exist: " + tenantDomain);
}
return getTenantAttributes(tenantDomain);
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:12,代码来源:MultiTAdminServiceImpl.java
示例19: invoke
import org.alfresco.repo.security.authentication.AuthenticationException; //导入依赖的package包/类
public Object invoke(MethodInvocation mi) throws Throwable
{
while (true)
{
try
{
MethodInvocation clone = ((ReflectiveMethodInvocation)mi).invocableClone();
return clone.proceed();
}
catch (AuthenticationException ae)
{
// Sleep for an interval and try again.
try
{
Thread.sleep(fRetryInterval);
}
catch (InterruptedException ie)
{
// Do nothing.
}
try
{
// Reauthenticate.
fAuthService.authenticate(fUser, fPassword.toCharArray());
String ticket = fAuthService.getCurrentTicket();
fTicketHolder.setTicket(ticket);
// Modify the ticket argument.
mi.getArguments()[0] = ticket;
}
catch (Exception e)
{
// Do nothing.
}
}
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:37,代码来源:ReauthenticatingAdvice.java
示例20: getAlfrescoTicket
import org.alfresco.repo.security.authentication.AuthenticationException; //导入依赖的package包/类
/**
* Returns the current Alfresco Ticket for the current user on
* the remote system, fetching if it isn't already cached.
*/
public RemoteAlfrescoTicketInfo getAlfrescoTicket(String remoteSystemId)
throws AuthenticationException, NoCredentialsFoundException, NoSuchSystemException, RemoteSystemUnavailableException
{
// Check we know about the system
ensureRemoteSystemKnown(remoteSystemId);
// Grab the user's details
BaseCredentialsInfo creds = getRemoteCredentials(remoteSystemId);
PasswordCredentialsInfo credentials = ensureCredentialsFound(remoteSystemId, creds);
// Is there a cached ticket?
String cacheKey = toCacheKey(remoteSystemId, credentials);
String ticket = ticketsCache.get(cacheKey);
// Refresh if if isn't cached
if (ticket == null)
{
return refreshTicket(remoteSystemId, credentials);
}
else
{
if (logger.isDebugEnabled())
logger.debug("Cached ticket found for " + creds.getRemoteUsername() + " on " + remoteSystemId);
// Wrap and return
return new AlfTicketRemoteAlfrescoTicketImpl(ticket);
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:33,代码来源:RemoteAlfrescoTicketServiceImpl.java
注:本文中的org.alfresco.repo.security.authentication.AuthenticationException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论