Skip to main content

Posts

Showing posts from November, 2016

Generate JWT access tokens from WSO2 Identity Server

In Identity Server 5.2.0 we have created an interface to generate access tokens. Using that we have developed a sample to generate JWT tokens. You can find that sample under msf4j samples[1][2]. If you are build it as it is you will need to use Java 8 to build since msf4j is developed on Java 8. So you will need to run Identity Server on Java 8 as well. After building the project[2] please copy the jar inside target directory to $IS_HOME/repository/components/dropins/ directory. And then please add the following configuration to Identity.xml which is placed under $IS_HOME/repository/conf/identity/ folder inside tag OAuth . <IdentityOAuthTokenGenerator>com.wso2.jwt.token.builder.JWTAccessTokenBuilder</IdentityOAuthTokenGenerator> Then go to the database you used to store oauth tokens (This is the database pointed from the datasource you mentioned in the $IS_HOME/repository/conf/identity/identity.xml) and then alter the size of the column ACCESS_TOKEN of the tab

WSO2 Identity Server 5.2.0 - Setup Multiple Attribute login with JDBC userstore

In WSO2 Products multiple attribute login (login with either email or username for example) can be done with LDAP Userstore manager with simply by changing some configurations. But with JDBC Userstore manager we need some customization to achieve that. We can achieve that by using Implementing a custom userstore manager. In this blog entry I am going to make work with email and username. You can find the full sample here[1] . For login purposes To login to the server with multiple attributes, you will need to override doAuthenticate method and doGetExternalRoleListOfUser method. Following are the overridden methods for login. @Override public boolean doAuthenticate(String attribute, Object credential) throws UserStoreException { if (!checkUserNameValid(attribute)) { return false; } if (!checkUserPasswordValid(credential)) { return false; } if (UserCoreUtil.isRegistryAnnonymousUser(attribute)) { log.error(&qu

Improving the new relic handler to push api input and output Parameters

In previous post I described how to publish API traffic to new relic[1]. I have done some modifications to the handler to cater $subject. You will need to change the code to match your exact requirements. And I did some improvements to the code as well. Please find my modified code attachment[2]. I have added following code segments to the handler let me describe of each segment. Following segment is to build message when POST type is used. Otherwise inside handler we will get an empty envelop. try { RelayUtils.buildMessage(((Axis2MessageContext)messageContext).getAxis2MessageContext()); } catch (Exception e) { log.warn("Error occured while building message"); if(log.isDebugEnabled()){ log.debug("Exception thrown while building message", e); } } Here I push data to new relic, each parameter as a different column. So please change the code as it match your requirement. Following code segment will extract post da