org.exoplatform.clouddrive.cmis.login
Class CodeAuthentication

java.lang.Object
  extended by org.exoplatform.clouddrive.cmis.login.CodeAuthentication

public class CodeAuthentication
extends Object

Maintain temporal codes for authentication in OAuth2 fashion. This component doesn't persist the codes. Only the last attempt actual (will work for the user).
Created by The eXo Platform SAS

Version:
$Id: CodeAuthentication.java 00000 Aug 19, 2014 pnedonosko $
Author:
Peter Nedonosko

Nested Class Summary
 class CodeAuthentication.Identity
           
 
Field Summary
static long IDENTITY_LIFETIME
          Lifetime of an identity in milliseconds.
protected static org.exoplatform.services.log.Log LOG
           
 
Constructor Summary
CodeAuthentication(org.exoplatform.services.idgenerator.IDGeneratorService idGenerator, org.exoplatform.services.jcr.RepositoryService jcrService)
           
 
Method Summary
 String authenticate(String serviceURL, String user, String password)
          Create user identity for given user name, password and a service URL.
 CodeAuthentication.Identity exchangeCode(String code)
          Exchange given code on user identity associated with this code in authenticate(String, String, String).
 boolean hasCode(String code)
          Deprecated. 
 boolean hasCodeContext(String code)
          Deprecated. 
 void setCodeContext(String code, String context)
          Set identity context for a code.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IDENTITY_LIFETIME

public static final long IDENTITY_LIFETIME
Lifetime of an identity in milliseconds.

See Also:
Constant Field Values

LOG

protected static final org.exoplatform.services.log.Log LOG
Constructor Detail

CodeAuthentication

public CodeAuthentication(org.exoplatform.services.idgenerator.IDGeneratorService idGenerator,
                          org.exoplatform.services.jcr.RepositoryService jcrService)
Method Detail

authenticate

public String authenticate(String serviceURL,
                           String user,
                           String password)
Create user identity for given user name, password and a service URL. This identity will be stored internally and an authentication code will be returned to the caller. Later this code can be exchanged on the identity in exchangeCode(String).

Parameters:
serviceURL - String
user - String
password - String
Returns:
String
See Also:
exchangeCode(String)

hasCode

@Deprecated
public boolean hasCode(String code)
Deprecated. 


exchangeCode

public CodeAuthentication.Identity exchangeCode(String code)
                                         throws AuthenticationException
Exchange given code on user identity associated with this code in authenticate(String, String, String). User identity after this method may be not fully initialized as for its context. Identity context is optional and can be initialized by setCodeContext(String, String) method once, after that call identity will be fully removed from the authenticator.
If given code wasn't associated with an user previously then AuthenticationException will be thrown.

Parameters:
code - String
Returns:
CodeAuthentication.Identity of an user
Throws:
AuthenticationException - if code doesn't match any user
See Also:
setCodeContext(String, String)

setCodeContext

public void setCodeContext(String code,
                           String context)
                    throws AuthenticationException
Set identity context for a code. The code may be already exchanged by exchangeCode(String), after this it will be fully removed from the authenticator.
If given code wasn't associated with an user previously then AuthenticationException will be thrown.

Parameters:
code - String
context - String
Throws:
AuthenticationException
See Also:
exchangeCode(String)

hasCodeContext

@Deprecated
public boolean hasCodeContext(String code)
Deprecated. 



Copyright © 2003–2015 eXo Platform SAS. All rights reserved.