Search in sources :

Example 1 with EncryptionException

use of org.owasp.esapi.errors.EncryptionException in project Asqatasun by Asqatasun.

the class TokenManager method getTokenUser.

/**
     *
     * @param userAccountName
     * @param additionalParameters
     * @return
     */
public String getTokenUser(String userAccountName, Map<String, String> additionalParameters) {
    try {
        CryptoToken cryptoToken = new CryptoToken();
        cryptoToken.setUserAccountName(userAccountName);
        cryptoToken.setExpiration(tokenDurationValidity);
        cryptoToken.addAttributes(additionalParameters);
        String token = cryptoToken.getToken();
        tokenUsage.put(token, Boolean.FALSE);
        return token;
    } catch (EncryptionException ex) {
        Logger.getLogger(this.getClass()).warn(ex);
        return "";
    } catch (ValidationException ex) {
        Logger.getLogger(this.getClass()).warn(ex);
        return "";
    }
}
Also used : CryptoToken(org.owasp.esapi.crypto.CryptoToken) ValidationException(org.owasp.esapi.errors.ValidationException) EncryptionException(org.owasp.esapi.errors.EncryptionException)

Example 2 with EncryptionException

use of org.owasp.esapi.errors.EncryptionException in project Asqatasun by Asqatasun.

the class TokenManager method getTokenUser.

/**
     *
     * @param userAccountName
     * @return
     */
public String getTokenUser(String userAccountName) {
    try {
        CryptoToken cryptoToken = new CryptoToken();
        cryptoToken.setUserAccountName(userAccountName);
        cryptoToken.setExpiration(tokenDurationValidity);
        String token = cryptoToken.getToken();
        tokenUsage.put(token, Boolean.FALSE);
        return token;
    } catch (EncryptionException ex) {
        Logger.getLogger(this.getClass()).warn(ex);
        return "";
    } catch (ValidationException ex) {
        Logger.getLogger(this.getClass()).warn(ex);
        return "";
    }
}
Also used : CryptoToken(org.owasp.esapi.crypto.CryptoToken) ValidationException(org.owasp.esapi.errors.ValidationException) EncryptionException(org.owasp.esapi.errors.EncryptionException)

Example 3 with EncryptionException

use of org.owasp.esapi.errors.EncryptionException in project Asqatasun by Asqatasun.

the class TokenManager method getTokenUser.

/**
 * @param userAccountName
 * @param additionalParameters
 * @return
 */
public String getTokenUser(String userAccountName, Map<String, String> additionalParameters) {
    try {
        CryptoToken cryptoToken = new CryptoToken();
        cryptoToken.setUserAccountName(userAccountName);
        cryptoToken.setExpiration(tokenDurationValidity);
        cryptoToken.addAttributes(additionalParameters);
        String token = cryptoToken.getToken();
        tokenUsage.put(token, Boolean.FALSE);
        return token;
    } catch (EncryptionException | ValidationException ex) {
        LOGGER.warn(ex.getMessage());
        return "";
    }
}
Also used : CryptoToken(org.owasp.esapi.crypto.CryptoToken) ValidationException(org.owasp.esapi.errors.ValidationException) EncryptionException(org.owasp.esapi.errors.EncryptionException)

Aggregations

CryptoToken (org.owasp.esapi.crypto.CryptoToken)3 EncryptionException (org.owasp.esapi.errors.EncryptionException)3 ValidationException (org.owasp.esapi.errors.ValidationException)3