use of com.sequenceiq.environment.credential.domain.Credential in project cloudbreak by hortonworks.
the class CredentialV1Controller method initCodeGrantFlow.
@Override
@CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_CREDENTIAL)
public Response initCodeGrantFlow(CredentialRequest credentialRequest) {
String accountId = ThreadBasedUserCrnProvider.getAccountId();
String userCrn = ThreadBasedUserCrnProvider.getUserCrn();
Credential credential = credentialConverter.convert(credentialRequest);
credential.setType(ENVIRONMENT);
String loginURL = credentialService.initCodeGrantFlow(accountId, credential, userCrn);
return Response.status(Status.FOUND).header("Referrer-Policy", "origin-when-cross-origin").header("Location", loginURL).build();
}
use of com.sequenceiq.environment.credential.domain.Credential in project cloudbreak by hortonworks.
the class CredentialV1Controller method verifyByCrn.
@Override
@CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DESCRIBE_CREDENTIAL)
public CredentialResponse verifyByCrn(@TenantAwareParam @ResourceCrn String crn) {
String accountId = ThreadBasedUserCrnProvider.getAccountId();
Credential credential = credentialService.getByCrnForAccountId(crn, accountId, ENVIRONMENT);
Credential verifiedCredential = credentialService.verify(credential);
return credentialConverter.convert(verifiedCredential);
}
use of com.sequenceiq.environment.credential.domain.Credential in project cloudbreak by hortonworks.
the class CredentialV1Controller method getByName.
@Override
@CheckPermissionByResourceName(action = AuthorizationResourceAction.DESCRIBE_CREDENTIAL)
public CredentialResponse getByName(@ResourceName String credentialName) {
String accountId = ThreadBasedUserCrnProvider.getAccountId();
Credential credential = credentialService.getByNameForAccountId(credentialName, accountId, ENVIRONMENT);
return credentialConverter.convert(credential);
}
use of com.sequenceiq.environment.credential.domain.Credential in project cloudbreak by hortonworks.
the class CredentialV1Controller method deleteByResourceCrn.
@Override
@CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DELETE_CREDENTIAL)
public CredentialResponse deleteByResourceCrn(@TenantAwareParam @ResourceCrn String crn) {
String accountId = ThreadBasedUserCrnProvider.getAccountId();
Credential deleted = credentialDeleteService.deleteByCrn(crn, accountId, ENVIRONMENT);
notify(ResourceEvent.CREDENTIAL_DELETED);
return credentialConverter.convert(deleted);
}
use of com.sequenceiq.environment.credential.domain.Credential in project cloudbreak by hortonworks.
the class CredentialV1Controller method interactiveLogin.
@Override
@CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_CREDENTIAL)
public InteractiveCredentialResponse interactiveLogin(@Valid CredentialRequest credentialRequest) {
String accountId = ThreadBasedUserCrnProvider.getAccountId();
Credential credential = credentialConverter.convert(credentialRequest);
credential.setType(ENVIRONMENT);
Map<String, String> result = credentialService.interactiveLogin(accountId, credential);
return new InteractiveCredentialResponse(result.get("user_code"), result.get("verification_url"));
}
Aggregations