Skip to content

Commit

Permalink
IVIS-46: Updated SDK chapter.
Browse files Browse the repository at this point in the history
  • Loading branch information
RuslanPopenko committed Dec 2, 2016
1 parent 43cd3a4 commit d803fcf
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 30 deletions.
Binary file added docs/images/services.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/sdk/api_description.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ API description
SDK simplify API invocation to easy steps:

#. Get service for entity
#. Invoke methods in that service
#. Invoke methods declared in that service

Examples how do that you will find at `Routines <http://docs.ivis.se/en/latest/sdk/routines.html>`_.

14 changes: 10 additions & 4 deletions docs/sdk/get_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,17 @@ Write in your pom.xml
<dependency>
<groupId>com.imcode.ivis</groupId>
<artifactId>ivis-core</artifactId>
<version>1.0.0-alpha1-SNAPSHOT</version>
<version>1.0.0-alpha1</version>
</dependency>
<dependency>
<groupId>com.imcode.ivis</groupId>
<artifactId>ivis-sdk</artifactId>
<version>1.0.0-alpha1-SNAPSHOT</version>
<version>1.0.0-alpha1</version>
</dependency>
<dependency>
<groupId>com.imcode.ivis</groupId>
<artifactId>ivis-services</artifactId>
<version>1.0.0-alpha1</version>
</dependency>
</dependencies>
Expand All @@ -89,6 +94,7 @@ Write in your build.gradle
.. code-block:: js
dependencies {
compile group:'com.imcode.ivis', name:'ivis-core', version:'1.0.0-alpha1-SNAPSHOT'
compile group:'com.imcode.ivis', name:'ivis-sdk',version:'1.0.0-alpha1-SNAPSHOT'
compile group:'com.imcode.ivis', name:'ivis-core', version:'1.0.0-alpha1'
compile group:'com.imcode.ivis', name:'ivis-sdk', version:'1.0.0-alpha1'
compile group:'com.imcode.ivis', name:'ivis-services', version:'1.0.0-alpha1'
}
6 changes: 3 additions & 3 deletions docs/sdk/routines/code/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ public class Configuration {
@Value("${client-secret}")
private String clientSecret;

@Value("#{'${api-server-address}' + '${user-authorization-relate-uri}'}")
@Value("#{'${api-server-address}' + '${user-authorization-relative-uri}'}")
private String userAuthorizationUri;

@Value("#{'${api-server-address}' + '${access-token-relate-uri}'}")
@Value("#{'${api-server-address}' + '${access-token-relative-uri}'}")
private String accessTokenUri;

@Bean
Expand All @@ -33,8 +33,8 @@ public OAuth2ProtectedResourceDetails clientBean() {
client.setClientSecret(clientSecret);
client.setAccessTokenUri(accessTokenUri);
client.setUserAuthorizationUri(userAuthorizationUri);
client.setScope(CollectionBuilder.asLinkedList("read", "write"));
return client;

}

@Bean
Expand Down
6 changes: 3 additions & 3 deletions docs/sdk/routines/code/IvisAuthorizationController.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
@Controller
public class IvisAuthorizationController {

@Value("#{'${client-address}' + '${redirect-relate-uri}'}")
@Value("#{'${client-address}' + '${redirect-relative-uri}'}")
private String redirectUri;

@Value("${refresh-token-validity-seconds")
private Integer refreshTokenValiditySeconds;

@Value("#{'${api-server-address}' + '${ivis-logout-relate-uri}'}")
@Value("#{'${api-server-address}' + '${ivis-logout-relative-uri}'}")
private String ivisLogoutUrl;

@Value("${client-address}")
Expand All @@ -45,7 +45,7 @@ public ModelAndView login(ModelAndView view) throws URISyntaxException {
return view;
}

@RequestMapping(value = "${redirect-relate-uri}", method = RequestMethod.GET)
@RequestMapping(value = "${redirect-relative-uri}", method = RequestMethod.GET)
public ModelAndView authorizationClientProcess(ModelAndView view,
HttpServletRequest request,
HttpServletResponse response,
Expand Down
6 changes: 3 additions & 3 deletions docs/sdk/routines/code/beansContext.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
p:grantType="authorization_code"
p:clientId="${client-id}"
p:clientSecret="secret"
p:accessTokenUri="#{'${api-server-address}' + '${user-authorization-relate-uri}'}"
p:userAuthorizationUri="#{'${api-server-address}' + '${access-token-relate-uri}'}"
p:scope="#{{'read', 'write'}}"/>
p:accessTokenUri="#{'${api-server-address}' + '${user-authorization-relative-uri}'}"
p:userAuthorizationUri="#{'${api-server-address}' + '${access-token-relative-uri}'}"
/>

</beans>
10 changes: 5 additions & 5 deletions docs/sdk/routines/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ Properties
api-server-address = http://ivis.dev.imcode.com
client-address = http://client.of.ivis.com
#client id that you receive form system administrator
#client id that you receive from system administrator
client-id = ff11397c-3e3b-4398-80a9-feba203f1928
redirect-relate-uri = /redirecttome
user-authorization-relate-uri = /oauth/authorize
access-token-relate-uri = /oauth/token
ivis-logout-relate-uri = /logout.do
redirect-relative-uri = /redirecttome
user-authorization-relative-uri = /oauth/authorize
access-token-relative-uri = /oauth/token
ivis-logout-relative-uri = /logout.do
Beans for injection
-------------------
Expand Down
15 changes: 6 additions & 9 deletions docs/sdk/routines/tokens_flow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ And also refresh token value from access token object put in cookie.

.. important::

Cookie has expiration time. It is defined by value refresh token validity seconds,
Cookie has expiration time. It is defined by value "Refresh token validity" in seconds,
contact system administrator to know that.

So tokens flow looks like
Expand All @@ -40,17 +40,14 @@ As you can see this method also logout user from iVIS.

.. note::

Don't forget write information about error page in web.xml.
In `Access to protected resources <http://docs.ivis.se/en/latest/sdk/routines/access_to_protected_resources.html>`_
routine described IvisAuthorizedFilter.

.. code-block:: xml
If user not logged in, filter intercept access to protected resources with response 401 status code.

<error-page>
<error-code>401</error-code>
<location>/unauthorized</location>
</error-page>
Or use something other way for redirect to /unauthorized.
.. importent::

Need in some way redirect user to /unauthorized handler method, when request has code 401.



Expand Down
4 changes: 2 additions & 2 deletions docs/sdk/routines/use_api_methods.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ And then just invoke API methods like Java methods.
List<Application> allApplications = applicationService.findAll();
.. tip::
All API services described at `ivis-services <https://github.com/imCodePartnerAB/iVIS/tree/master/ivis-services/src/main/java/com/imcode/services>`_ module.

How to know what concrete method needs? Just see service interface methods: name, in parameters and return type.
:download:`Class diagram </images/services.png>` of all interfaces with methods.



Expand Down

0 comments on commit d803fcf

Please sign in to comment.