use of org.wso2.carbon.identity.mgt.store.JDBCUserRecoveryDataStore in project carbon-identity-framework by wso2.
the class UserIdentityManagementUtil method invalidateUserIdentityMetadata.
/**
* Invalidates the identity metadata
*
* @param userName
* @param tenantId
* @param metadataType
* @param metadata
* @throws IdentityException
*/
public static void invalidateUserIdentityMetadata(String userName, int tenantId, String metadataType, String metadata) throws IdentityException {
JDBCUserRecoveryDataStore store = new JDBCUserRecoveryDataStore();
UserRecoveryDataDO metadataDO = new UserRecoveryDataDO(userName, tenantId, metadataType, metadata);
store.invalidate(metadataDO);
}
use of org.wso2.carbon.identity.mgt.store.JDBCUserRecoveryDataStore in project carbon-identity-framework by wso2.
the class UserIdentityManagementUtil method getPrimaryQuestions.
/**
* Returns an array of primary security questions
*
* @param tenantId
* @return
* @throws IdentityException
*/
public static String[] getPrimaryQuestions(int tenantId) throws IdentityException {
JDBCUserRecoveryDataStore store = new JDBCUserRecoveryDataStore();
UserRecoveryDataDO[] metadata = store.load("TENANT", tenantId);
if (metadata.length < 1) {
return new String[0];
}
List<String> validSecurityQuestions = new ArrayList<String>();
String[] questionsList = new String[validSecurityQuestions.size()];
return validSecurityQuestions.toArray(questionsList);
}
use of org.wso2.carbon.identity.mgt.store.JDBCUserRecoveryDataStore in project carbon-identity-framework by wso2.
the class UserIdentityManagementUtil method storeUserIdentityMetadata.
/**
* Stores new metadata
*
* @param metadata
* @throws IdentityException
*/
public static void storeUserIdentityMetadata(UserRecoveryDataDO metadata) throws IdentityException {
JDBCUserRecoveryDataStore store = new JDBCUserRecoveryDataStore();
metadata.setValid(true);
store.store(metadata);
}
use of org.wso2.carbon.identity.mgt.store.JDBCUserRecoveryDataStore in project carbon-identity-framework by wso2.
the class UserIdentityManagementUtil method addPrimaryQuestions.
/**
* Add or update primary security questions
*
* @param primarySecurityQuestion
* @param tenantId
* @throws IdentityException
*/
public static void addPrimaryQuestions(String[] primarySecurityQuestion, int tenantId) throws IdentityException {
JDBCUserRecoveryDataStore store = new JDBCUserRecoveryDataStore();
UserRecoveryDataDO[] metadata = new UserRecoveryDataDO[primarySecurityQuestion.length];
int i = 0;
for (String secQuestion : primarySecurityQuestion) {
if (!secQuestion.contains(UserCoreConstants.ClaimTypeURIs.CHALLENGE_QUESTION_URI)) {
throw IdentityException.error("One or more security questions does not contain the namespace " + UserCoreConstants.ClaimTypeURIs.CHALLENGE_QUESTION_URI);
}
metadata[i++] = new UserRecoveryDataDO("TENANT", tenantId, UserRecoveryDataDO.METADATA_PRIMARAY_SECURITY_QUESTION, secQuestion);
}
store.store(metadata);
}
Aggregations