use of com.sequenceiq.environment.credential.domain.Credential in project cloudbreak by hortonworks.
the class AuditCredentialV1Controller method deleteByResourceCrn.
@Override
@CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_AUDIT_CREDENTIAL)
public CredentialResponse deleteByResourceCrn(String crn) {
String accountId = ThreadBasedUserCrnProvider.getAccountId();
Credential deleted = credentialDeleteService.deleteByCrn(crn, accountId, AUDIT);
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 post.
@Override
@CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_CREDENTIAL)
public CredentialResponse post(@Valid CredentialRequest request) {
String accountId = ThreadBasedUserCrnProvider.getAccountId();
String creator = ThreadBasedUserCrnProvider.getUserCrn();
Credential credential = credentialConverter.convert(request);
credential.setType(ENVIRONMENT);
notify(ResourceEvent.CREDENTIAL_CREATED);
return credentialConverter.convert(credentialService.create(credential, accountId, creator, ENVIRONMENT));
}
use of com.sequenceiq.environment.credential.domain.Credential in project cloudbreak by hortonworks.
the class CredentialV1Controller method put.
@Override
@CheckPermissionByRequestProperty(path = "name", type = NAME, action = EDIT_CREDENTIAL)
public CredentialResponse put(@RequestObject @Valid EditCredentialRequest credentialRequest) {
Credential credential = credentialConverter.convert(credentialRequest);
credential.setType(ENVIRONMENT);
credential = credentialService.updateByAccountId(credential, ThreadBasedUserCrnProvider.getAccountId(), ENVIRONMENT);
notify(ResourceEvent.CREDENTIAL_MODIFIED);
return credentialConverter.convert(credential);
}
use of com.sequenceiq.environment.credential.domain.Credential in project cloudbreak by hortonworks.
the class CredentialV1Controller method authorizeCodeGrantFlow.
@Override
@CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_CREDENTIAL)
public CredentialResponse authorizeCodeGrantFlow(String platform, String code, String state) {
String accountId = ThreadBasedUserCrnProvider.getAccountId();
Credential credential = credentialService.authorizeCodeGrantFlow(code, state, accountId, platform);
notify(ResourceEvent.CREDENTIAL_CREATED);
return credentialConverter.convert(credential);
}
use of com.sequenceiq.environment.credential.domain.Credential in project cloudbreak by hortonworks.
the class CredentialV1Controller method verifyByName.
@Override
@CheckPermissionByResourceName(action = AuthorizationResourceAction.DESCRIBE_CREDENTIAL)
public CredentialResponse verifyByName(@ResourceName String name) {
String accountId = ThreadBasedUserCrnProvider.getAccountId();
Credential credential = credentialService.getByNameForAccountId(name, accountId, ENVIRONMENT);
Credential verifiedCredential = credentialService.verify(credential);
return credentialConverter.convert(verifiedCredential);
}
Aggregations