use of io.hops.hopsworks.persistence.entity.remote.oauth.OauthClient in project hopsworks by logicalclocks.
the class VariablesService method getAuthStatus.
@GET
@Path("authStatus")
@Produces(MediaType.APPLICATION_JSON)
@JWTNotRequired
@Deprecated
public Response getAuthStatus() {
List<OauthClient> oauthClients = oauthClientFacade.findAll();
List<OpenIdProvider> providers = new ArrayList<>();
for (OauthClient client : oauthClients) {
providers.add(new OpenIdProvider(client.getProviderName(), client.getProviderDisplayName(), client.getProviderLogoURI()));
}
AuthStatus authStatus = new AuthStatus(settings.getTwoFactorAuth(), settings.getLDAPAuthStatus(), settings.getKRBAuthStatus(), settings.isPasswordLoginDisabled(), settings.isRegistrationUIDisabled(), providers);
return noCacheResponse.getNoCacheResponseBuilder(Response.Status.OK).entity(authStatus).build();
}
use of io.hops.hopsworks.persistence.entity.remote.oauth.OauthClient in project hopsworks by logicalclocks.
the class VariablesService method getAuthenticationStatus.
@GET
@Path("authenticationStatus")
@Produces(MediaType.APPLICATION_JSON)
@JWTNotRequired
public Response getAuthenticationStatus() {
boolean remoteAuthEnabled = remoteUserHelper.isRemoteUserAuthAvailable();
List<OpenIdProvider> providers = new ArrayList<>();
if (remoteAuthEnabled) {
List<OauthClient> oauthClients = oauthClientFacade.findAll();
for (OauthClient client : oauthClients) {
providers.add(new OpenIdProvider(client.getProviderName(), client.getProviderDisplayName(), client.getProviderLogoURI()));
}
}
AuthenticationStatus authenticationStatus = new AuthenticationStatus(OTPAuthStatus.fromTwoFactorMode(settings.getTwoFactorAuth()), settings.isLdapEnabled(), settings.isKrbEnabled(), settings.isOAuthEnabled(), providers, settings.isPasswordLoginDisabled(), settings.isRegistrationUIDisabled(), remoteAuthEnabled);
return Response.ok(authenticationStatus).build();
}
use of io.hops.hopsworks.persistence.entity.remote.oauth.OauthClient in project hopsworks by logicalclocks.
the class OAuthClientRegistration method onRowEdit.
public void onRowEdit(RowEditEvent event) {
if (!checkOAuthHelper()) {
return;
}
OauthClient oauthClient = (OauthClient) event.getObject();
try {
oAuthClientHelper.getoAuthHelper().updateClient(oauthClient);
MessagesController.addInfoMessage("Updated OAuth server.");
} catch (Exception e) {
MessagesController.addErrorMessage(e.getMessage(), getRootCause(e));
}
}
use of io.hops.hopsworks.persistence.entity.remote.oauth.OauthClient in project hopsworks by logicalclocks.
the class OAuthClientRegistration method saveClient.
public void saveClient() {
if (!providerMetadataEndpointSupported && (authorisationEndpoint == null || authorisationEndpoint.isEmpty() || tokenEndpoint == null || tokenEndpoint.isEmpty() || userInfoEndpoint == null || userInfoEndpoint.isEmpty() || jwksURI == null || jwksURI.isEmpty())) {
LOGGER.log(Level.WARNING, "Failed to create client. Required field/s missing.");
MessagesController.addErrorMessage("Failed to create client.", "Missing required field/s.");
return;
}
try {
OauthClient oauthClient = new OauthClient(this.clientId, this.clientSecret, this.providerURI, this.providerName, this.providerLogoURI, this.providerDisplayName, this.providerMetadataEndpointSupported, this.authorisationEndpoint, this.tokenEndpoint, this.userInfoEndpoint, this.jwksURI);
oAuthClientHelper.getoAuthHelper().saveClient(oauthClient);
MessagesController.addInfoMessage("Added new OAuth server.");
init();
} catch (Exception e) {
LOGGER.log(Level.WARNING, "Failed to create client. {0}", e.getMessage());
MessagesController.addErrorMessage(e.getMessage(), getRootCause(e));
}
}
Aggregations