Comments (3)
Here are some tips:
- Try avoiding
.scopeToDomain(identifier)
, you are passing the domain already as third argument tocredentials
method. - Turn on wire logging (
OSFactory.enableHttpLoggingFilter(true)
) and compare the payload sent by openstack4j.
from openstack4j.
Aqui estão algumas dicas:
- Tente evitar
.scopeToDomain(identifier)
, você já está passando o domínio como terceiro argumento para ocredentials
método.- Ligue o wire logging (
OSFactory.enableHttpLoggingFilter(true)
) e compare a carga enviada pelo openstack4j.
Hi,
I removed the .scopetoDomain() and am getting a 403 Forbidden.
Here is the code error:
2020-10-06 16:56:30.644 INFO 5340 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2020-10-06 16:56:30.655 INFO 5340 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 11 ms
Data ===================>RegisterDataRequestDTO(registerInfoRequestDTO=RegisterInfoRequestDTO(identifier=123, name=test123, secret=12321, email=123213, isAdmin=false))
2020-10-06 16:56:32.103 ERROR 5340 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is ClientResponseException{message=You are not authorized to perform the requested action: identity:list_domains., status=403, status-code=FORBIDDEN, X-Openstack-Request-Id=req-1304fcdf-9ae6-4e66-8442-000a117eeff4}] with root cause
org.openstack4j.api.exceptions.ClientResponseException: You are not authorized to perform the requested action: identity:list_domains.
at org.openstack4j.api.exceptions.ResponseException.mapException(ResponseException.java:84) ~[openstack4j-3.8-withdeps.jar:na]
Where do I enable wire logging?
My code:
public class OpenStackAuth {
public static OSClientV3 getOsClientV3() {
return OSFactory.builderV3()
.endpoint("http://xxx.xxx.xxx.xx/5000/v3")
.credentials("admin", "admin1234", Identifier.byId("default"))
.authenticate();
}
}
@Api(value="Manager Servers")
@RestController
@RequestMapping("/identities")
public class IdentityController {
@CrossOrigin
@PostMapping("/users/register")
public UserDataResponseDTO register(@RequestBody RegisterDataRequestDTO registerDataRequestDTO) {
System.out.println("Data ===================>" + registerDataRequestDTO);
Objects.requireNonNull(registerDataRequestDTO, "registerDataRequestDTO must be not null.");
OSClientV3 osClientV3 = getOsClientV3();
Domain domain = osClientV3.identity().domains()
.getByName(registerDataRequestDTO.getRegisterInfoRequestDTO().getIdentifier()).stream()
.findAny()
.orElse(null);
if (Objects.isNull(domain)) {
domain = osClientV3.identity().domains()
.create(Builders.domain().enabled(true)
.name(registerDataRequestDTO.getRegisterInfoRequestDTO().getIdentifier())
.build());
}
Project project = new KeystoneProject().toBuilder().enabled(true).domainId(domain.getId())
.name(registerDataRequestDTO.getRegisterInfoRequestDTO().getName()).build();
project = osClientV3.identity().projects().create(project);
User user = osClientV3.identity().users().create(Builders.user()
.domainId(domain.getId())
.name(registerDataRequestDTO.getRegisterInfoRequestDTO().getName())
.defaultProjectId(project.getId())
.password(
registerDataRequestDTO.getRegisterInfoRequestDTO().getSecret())
.email(registerDataRequestDTO.getRegisterInfoRequestDTO().getEmail())
.enabled(true)
.defaultProjectId(project.getId())
.build());
osClientV3.compute().keypairs()
.create(registerDataRequestDTO.getRegisterInfoRequestDTO().getIdentifier(), null);
return UserDataResponseDTO.builder().userID(user.getId()).domainID(domain.getId())
.name(user.getName()).build();
}
}
from openstack4j.
Call OSFactory.enableHttpLoggingFilter(true)
to get the wire logging enabled. Note this is specific to http controller, so the log format and even support might vary.
from openstack4j.
Related Issues (20)
- SnakeYAML 1.33 dependency really used?! HOT 2
- The HostAggreate.getHosts() returns host name instead of host id. HOT 1
- PATCH method fails with 415 Unsupported Media Type HOT 1
- Unclear maintenance status of openstack4j HOT 1
- V3 Authentication fails, no matter what HOT 1
- Swift: Better and state-of-the-art pagination of objects
- Neutron: Add support for removing previously added DNS servers and host routes on subnet update
- Manifest file has its original size
- Gnocchi: Use the Gnocchi API for telemetry HOT 1
- Glance. Support for image move from one storage to another.
- Glance. Cant retrieve image locations.
- NOVA. Creating snapshot/image from VM
- Heat: Add support for /preview endpoint in Orchestration API
- Neutron: Add support for subnetId field in the FloatingIP model
- Endpoint URL Resolution in openstack4j: Catalog-Based Service Selection for cinder service get request
- `OSBadBooleanDeserializer` not compatible with Jackson 2.16.x
- There was a problem using openstack4j for domain level authentication
- This library shouldn't expose volume os-attach calls for trying to attach a cinder volume.
- Get volumes list with parameter - unexpected behavior
- Umbrella feature requests for Neturon, Nova, Cinder
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openstack4j.