Product
Introducing Socket Optimize
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.
syshub-rest-module
Advanced tools
This package provides a generic library for the communication from an Angular SPA with a NT-Ware uniFLOW sysHUB backend server based on HTTPS Rest API with OAuth2 flow.
This package provides a generic library for the communication from an Angular SPA with a NT-Ware uniFLOW sysHUB backend server based on HTTPS Rest API with OAuth2 flow. The contained Rest Service provides methods for login and logout-functionality and an automatic token refresh. Furthermore you can use the get- and post-methods to send a request to any sysHUB Rest API endpoint. The package contains anything needed for the communication, just at it as a provider to your application and provide it with settings like hostname and credentials.
Run npm i syshub-rest-module
in your project root to add this library as dependency. After that, create a configuration (for example in your environment.ts
) for the credentials:
export const environment = {
syshub: {
host: "http://localhost:8088/",
basic: {
enabled: false,
username: "foo",
password: "foo!bar",
provider: "<syshubApiserverName>",
},
oauth: {
enabled: true,
clientId: "<syshubAuthserverClientId>",
clientSecret: "<syshubAuthserverClientSecret>",
}
}
};
Make sure to enable either basic auth or oauth. Basic auth requires an authentication provider that you must set up in API Server configuration. This is not required for OAuth authentication.
In your app.module.ts
add the following three providers:
import { RestService, RestSettings, Settings, SyshubInterceptor } from 'syshub-rest-module';
...
providers: [
{ provide: Settings, multi: false, useValue: new Settings(<RestSettings>(environment.syshub)) },
{ provide: RestService, multi: false, deps: [Settings, HttpClient] },
{ provide: HTTP_INTERCEPTORS, multi: true, useClass: SyshubInterceptor, deps: [Settings, HttpClient] }
],
The Settings-provider requires an initialized object of type Settings
, where the constructor expects an object that implements the RestSettings
interface. For an example, see the Install chapter.
Within your components you are now able to access all service methods and properties. For example:
import { RestService } from 'syshub-rest-module';
...
export class AppComponent {
...
constructor(private restService: RestService) {}
...
sendLogin(): void {
this.restService.login(this.username, this.password).subscribe((response) => {
console.log(response)
if (response == null) // initial status
return;
if (response === true) {
// login successfull
}
else {
// login failed
}
});
}
...
}
Comming soon...
Comming soon...
FAQs
This package provides a generic library for the communication from an Angular SPA with a NT-Ware uniFLOW sysHUB backend server based on HTTPS Rest API with OAuth2 flow.
The npm package syshub-rest-module receives a total of 2 weekly downloads. As such, syshub-rest-module popularity was classified as not popular.
We found that syshub-rest-module demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.
Product
We're excited to announce that Socket now supports the Java programming language.
Security News
Socket detected a malicious Python package impersonating a popular browser cookie library to steal passwords, screenshots, webcam images, and Discord tokens.