use of com.auth0.json.mgmt.client.Client in project chemvantage by chuckwight.
the class LTIRegistration method clientIdForm.
String clientIdForm(String token) {
StringBuffer buf = new StringBuffer(Subject.banner);
String iss = null;
String sub = null;
String email = null;
String aud = null;
String url = null;
String lms = null;
try {
// registration token is valid for only 3 days
DecodedJWT jwt = JWT.decode(token);
iss = jwt.getIssuer();
sub = jwt.getSubject();
email = jwt.getClaim("email").asString();
aud = jwt.getAudience().get(0);
url = jwt.getClaim("url").asString();
lms = jwt.getClaim("lms").asString();
buf.append("<h4>To the LMS Administrator:</h4>" + "By now you should have configured your LMS to connect with ChemVantage, and you should have " + "received a client_id from your LMS that identifies the ChemVantage tool and a deployment_id " + "that identifies your account in your LMS. Please enter these values here:<p>" + "<form method=post action=/lti/registration>" + "<input type=hidden name=UserRequest value='finalize'>" + "<input type=hidden name=Token value='" + token + "'>");
switch(lms) {
case "blackboard":
String clientId = (iss.equals("https://dev-vantage-hrd.appspot.com") ? "ec076e8c-b90f-4ecf-9b5d-a9eff03976be" : "be1004de-6f8e-45b9-aae4-2c1370c24e1e");
buf.append("<input type=hidden name=ClientId value=" + clientId + ">");
buf.append("Client ID: " + clientId + "<br>" + "Deployment ID: <input type=text size=40 name=DeploymentId><p>");
break;
case "canvas":
buf.append("Canvas account URL: <input type=text size=40 name=AccountUrl placeholder=https://myschool.instructure.com><p>");
buf.append("Canvas uses the developer key as the client_id, so enter that value from the list of " + "developer keys. It is a numeric value that looks something like 32570000000000041.<br/>");
buf.append("client_id: <input type=text size=40 name=ClientId><p>");
buf.append("The deployment_id can be found in Settings | Apps | App Configurations by opening the " + "settings menu for ChemVantage. It is a compound value that consists of a number and a hex string " + "separated by a colon and looks something like 10408:7db438070728c02373713c12c73869b3af470b68.<br>");
buf.append("deployment_id: <input type=text size=50 name=DeploymentId><p>");
break;
case "LTI Certification":
buf.append("<input type=hidden name=DeploymentId value=testdeploy />");
buf.append("Deployment ID: testdeploy<br>" + "Client ID: <input type=text size=40 name=ClientId><p>");
break;
default:
buf.append("Client ID: <input type=text size=40 name=ClientId><br>" + "Deployment ID: <input type=text size=40 name=DeploymentId><p>");
buf.append("In addition, ChemVantage needs URLs for the end points on your LMS in order to access services " + "(e.g., Assignment and Grade Services) provided by your LMS platform. All fields are required, " + "and all URLs should begin with https://<br>" + "Platform ID: <input type=text size=40 name=PlatformId> (base URL for your LMS)<br>" + "Platform OIDC Auth URL: <input type=text name=OIDCAuthUrl><br>" + "Platform OAuth Access Token URL: <input type=text name=OauthAccessTokenUrl><br>" + "Platform JSON Web Key Set URL: <input type=text name=JWKSUrl><br>");
}
buf.append("<input type=submit value='Complete the LTI Registration'></form>");
} catch (Exception e) {
buf.append("<h3>Registration Failed</h3>" + e.getMessage() + "<p>" + "Name: " + sub + "<br>" + "Email: " + email + "<br>" + "Organization: " + aud + "<br>" + "Home Page: " + url + "<p>" + "The token provided with this link could not be validated. It may have expired (after 3 days) " + "or it may not have contained enough information to complete the registration request. You " + "may <a href=/lti/registration>start the registration process again</a> or contact " + "Chuck Wight (admin@chemvantage.org) for assistance.");
}
return buf.toString();
}
use of com.auth0.json.mgmt.client.Client in project auth0-java by auth0.
the class LogStreamsEntity method delete.
/**
* Creates a request to delete a Log Stream.
* See the <a href="https://auth0.com/docs/api/management/v2#!/Log_Streams/delete_log_streams_by_id">API Documentation for more information.</a>
*
* @param logStreamId The ID of the Log Stream to delete.
* @return the request to execute.
*/
public Request<Void> delete(String logStreamId) {
Asserts.assertNotNull(logStreamId, "log stream id");
String url = baseUrl.newBuilder().addPathSegments(LOG_STREAMS_PATH).addPathSegment(logStreamId).build().toString();
VoidRequest request = new VoidRequest(client, url, "DELETE");
request.addHeader(AUTHORIZATION_HEADER, "Bearer " + apiToken);
return request;
}
use of com.auth0.json.mgmt.client.Client in project auth0-java by auth0.
the class OrganizationsEntity method deleteRoles.
/**
* Delete roles from a member of an organization. A token with {@code delete:organization_member_roles} scope is required.
*
* @param orgId the ID of the organization
* @param userId the ID of the user
* @param roles the roles to delete
* @return a Request to execute
*
* @see <a href="https://auth0.com/docs/api/management/v2#!/Organizations/delete_organization_member_roles">https://auth0.com/docs/api/management/v2#!/Organizations/delete_organization_member_roles</a>
*/
public Request<Void> deleteRoles(String orgId, String userId, Roles roles) {
Asserts.assertNotNull(orgId, "organization ID");
Asserts.assertNotNull(userId, "user ID");
Asserts.assertNotNull(roles, "roles");
String url = baseUrl.newBuilder().addPathSegments(ORGS_PATH).addPathSegment(orgId).addPathSegment("members").addPathSegment(userId).addPathSegment("roles").build().toString();
VoidRequest request = new VoidRequest(client, url, "DELETE");
request.addHeader(AUTHORIZATION_HEADER, "Bearer " + apiToken);
request.setBody(roles);
return request;
}
use of com.auth0.json.mgmt.client.Client in project auth0-java by auth0.
the class OrganizationsEntity method delete.
/**
* Delete an organization. A token with {@code delete:organizations} scope is required.
*
* @param orgId the ID of the organization to delete
* @return a Request to execute
*
* @see <a href="https://auth0.com/docs/api/management/v2#!/Organizations/delete_organizations_by_id">https://auth0.com/docs/api/management/v2#!/Organizations/delete_organizations_by_id</a>
*/
public Request<Void> delete(String orgId) {
Asserts.assertNotNull(orgId, "organization ID");
String url = baseUrl.newBuilder().addPathSegments(ORGS_PATH).addPathSegment(orgId).build().toString();
VoidRequest voidRequest = new VoidRequest(client, url, "DELETE");
voidRequest.addHeader(AUTHORIZATION_HEADER, "Bearer " + apiToken);
return voidRequest;
}
use of com.auth0.json.mgmt.client.Client in project auth0-java by auth0.
the class OrganizationsEntity method addRoles.
/**
* Add roles for a member of an organization. A token with {@code create:organization_member_roles} scope is required.
*
* @param orgId the ID of the organization
* @param userId the ID of the user
* @param roles the roles to add
* @return a Request to execute
*
* @see <a href="https://auth0.com/docs/api/management/v2#!/Organizations/post_organization_member_roles">https://auth0.com/docs/api/management/v2#!/Organizations/post_organization_member_roles</a>
*/
public Request<Void> addRoles(String orgId, String userId, Roles roles) {
Asserts.assertNotNull(orgId, "organization ID");
Asserts.assertNotNull(userId, "user ID");
Asserts.assertNotNull(roles, "roles");
String url = baseUrl.newBuilder().addPathSegments(ORGS_PATH).addPathSegment(orgId).addPathSegment("members").addPathSegment(userId).addPathSegment("roles").build().toString();
VoidRequest request = new VoidRequest(client, url, "POST");
request.addHeader(AUTHORIZATION_HEADER, "Bearer " + apiToken);
request.setBody(roles);
return request;
}
Aggregations