Skip to content

Commit

Permalink
Added logging
Browse files Browse the repository at this point in the history
  • Loading branch information
oharsta committed Oct 16, 2023
1 parent 97a93b8 commit 6017c6f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions server/src/main/java/access/provision/graph/GraphClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import access.exception.RemoteException;
import access.model.User;
import access.provision.Provisioning;
import access.provision.ProvisioningServiceDefault;
import com.azure.identity.ClientSecretCredential;
import com.azure.identity.ClientSecretCredentialBuilder;
import com.microsoft.graph.authentication.TokenCredentialAuthProvider;
Expand All @@ -12,7 +11,6 @@
import com.microsoft.graph.requests.GraphServiceClient;
import com.microsoft.graph.requests.InvitationCollectionRequest;
import com.microsoft.graph.requests.UserRequest;
import com.microsoft.graph.requests.UserRequestBuilder;
import okhttp3.Request;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Expand All @@ -23,7 +21,7 @@

public class GraphClient {

private static final Log LOG = LogFactory.getLog(ProvisioningServiceDefault.class);
private static final Log LOG = LogFactory.getLog(GraphClient.class);

private final String serverUrl;
private final String eduidIdpSchacHomeOrganization;
Expand All @@ -46,7 +44,7 @@ public GraphResponse newUserRequest(Provisioning provisioning, User user) {
invitation.invitedUserEmailAddress = eduidIdpSchacHomeOrganization.equalsIgnoreCase(user.getSchacHomeOrganization()) ? user.getEduPersonPrincipalName() : user.getEmail();
invitation.invitedUserDisplayName = user.getName();
invitation.inviteRedirectUrl = String.format("%s/api/v1/invitations/ms-accept-return/%s/%s",
serverUrl, provisioning.getId(),user.getId());
serverUrl, provisioning.getId(), user.getId());
invitation.sendInvitationMessage = false;
invitation.invitedUserType = "Guest";

Expand All @@ -56,6 +54,11 @@ public GraphResponse newUserRequest(Provisioning provisioning, User user) {
user.getEduPersonPrincipalName()));
try {
com.microsoft.graph.models.Invitation newInvitation = buildRequest.post(invitation);

LOG.info(String.format("Response from graph endpoint for user %s, inviteRedeemUrl: %s",
user.getEmail(),
newInvitation.inviteRedeemUrl
));
return new GraphResponse(newInvitation.invitedUser.id, newInvitation.inviteRedeemUrl);
} catch (ClientException e) {
String errorMessage = String.format("Error Graph request (entityID %s) to %s for user %s",
Expand Down

0 comments on commit 6017c6f

Please sign in to comment.