TrustedDevicesDao.java revision 41c1067de1a5fa74255d311e5362548ae41f9a04
/*
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2014 ForgeRock AS.
*/
/**
* Dao for handling the retrieval and saving of a user's trusted devices.
*
* @since 12.0.0
*/
public class TrustedDevicesDao {
/**
* Gets a user's trusted device profiles.
*
* @param context The CREST context.
* @return A list of trusted device profiles.
* @throws InternalServerErrorException If there is a problem retrieving the device profiles.
*/
try {
}
return devices;
} catch (SSOException e) {
throw new InternalServerErrorException(e.getMessage(), e);
} catch (JsonParseException e) {
throw new InternalServerErrorException(e.getMessage(), e);
} catch (JsonMappingException e) {
throw new InternalServerErrorException(e.getMessage(), e);
} catch (IdRepoException e) {
throw new InternalServerErrorException(e.getMessage(), e);
} catch (IOException e) {
throw new InternalServerErrorException(e.getMessage(), e);
}
}
/**
* Saves a user's trusted device proiles.
*
* @param context The CREST context.
* @param profiles The user's trusted device profiles to store.
* @throws InternalServerErrorException If there is a problem storing the device profiles.
*/
void saveDeviceProfiles(Context context, List<JsonValue> profiles) throws InternalServerErrorException {
}
try {
} catch (SSOException e) {
throw new InternalServerErrorException(e.getMessage(), e);
} catch (IdRepoException e) {
throw new InternalServerErrorException(e.getMessage(), e);
}
}
/**
* Gets the authenticated user's name.
*
* @param context The CREST context.
* @return The user name.
*/
}
/**
* Gets the realm of the authenticated user.
*
* @param context The CREST context.
* @return The user's realm.
*/
}
/**
* Gets the {@code AMIdentity} for the authenticated user.
*
* @param userName The user's name.
* @param realm The user's realm.
* @return An {@code AMIdentity}.
* @throws InternalServerErrorException If there is a problem getting the users identity.
*/
idsc.setAllReturnAttributes(true);
try {
if (searchResults != null) {
}
+ " is not found");
throw new IdRepoException(
"getIdentity : More than one user found for the userName "
+ userName);
}
} catch (IdRepoException e) {
throw new InternalServerErrorException(e.getMessage(), e);
} catch (SSOException e) {
throw new InternalServerErrorException(e.getMessage(), e);
}
return amIdentity;
}
}