use of com.sequenceiq.authorization.annotation.CheckPermissionByAccount in project cloudbreak by hortonworks.
the class AuditCredentialV1Controller method deleteByName.
@Override
@CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_AUDIT_CREDENTIAL)
public CredentialResponse deleteByName(String name) {
String accountId = ThreadBasedUserCrnProvider.getAccountId();
Credential deleted = credentialDeleteService.deleteByName(name, accountId, AUDIT);
notify(ResourceEvent.CREDENTIAL_DELETED);
return credentialConverter.convert(deleted);
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByAccount in project cloudbreak by hortonworks.
the class AuditCredentialV1Controller method put.
@Override
@CheckPermissionByAccount(action = AuthorizationResourceAction.MODIFY_AUDIT_CREDENTIAL)
public CredentialResponse put(@Valid EditCredentialRequest credentialRequest) {
Credential credential = credentialConverter.convert(credentialRequest);
credential.setType(AUDIT);
credential = credentialService.updateByAccountId(credential, ThreadBasedUserCrnProvider.getAccountId(), AUDIT);
notify(ResourceEvent.CREDENTIAL_MODIFIED);
return credentialConverter.convert(credential);
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByAccount 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.authorization.annotation.CheckPermissionByAccount 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"));
}
use of com.sequenceiq.authorization.annotation.CheckPermissionByAccount in project cloudbreak by hortonworks.
the class DatabaseServerV4Controller method register.
@CheckPermissionByAccount(action = AuthorizationResourceAction.REGISTER_DATABASE_SERVER)
public DatabaseServerV4Response register(DatabaseServerV4Request request) {
MDCBuilder.addEnvironmentCrn(request.getEnvironmentCrn());
DatabaseServerConfig server = databaseServerConfigService.create(databaseServerV4RequestToDatabaseServerConfigConverter.convert(request), DEFAULT_WORKSPACE, false);
// notify(ResourceEvent.DATABASE_SERVER_CONFIG_CREATED);
return databaseServerConfigToDatabaseServerV4ResponseConverter.convert(server);
}
Aggregations