Project

General

Profile

« Previous | Next » 

Revision 59620

scopes now read from properties + get refresh tokens delets the old ones.

View differences:

modules/uoa-login-core/trunk/src/main/java/eu/dnetlib/openaire/user/login/utils/AuthoritiesMapper.java
22 22
        HashSet<SimpleGrantedAuthority> authorities = new HashSet<>();
23 23
        logger.info("entitlements" + entitlements.size());
24 24
        String  regex = "urn:geant:openaire[.]eu:group:(\\w+[\\W]*\\w+[-\\w]*):?(.*)?:role=member#aai[.]openaire[.]eu";
25
        authorities.add(new SimpleGrantedAuthority("REGISTERED_USER"));
25 26
        for(JsonElement obj: entitlements) {
26 27
            Matcher matcher = Pattern.compile(regex).matcher(obj.getAsString());
27 28
            if (matcher.find()) {
modules/uoa-login-core/trunk/src/main/java/eu/dnetlib/openaire/user/login/utils/ScopeReader.java
1
package eu.dnetlib.openaire.user.login.utils;
2

  
3
import org.springframework.stereotype.Component;
4

  
5
import java.util.*;
6

  
7
public class ScopeReader {
8

  
9
    Set<String> scopes;
10

  
11
    public ScopeReader(String property) {
12
        if (!property.trim().isEmpty()){
13
            scopes = new HashSet<String>();
14
            Collections.addAll(scopes, property.split(","));
15
        }
16
    }
17

  
18
    public Set<String> getScopes() {
19
        return scopes;
20
    }
21

  
22
    public void setScopes(Set<String> scopes) {
23
        this.scopes = scopes;
24
    }
25
}
modules/uoa-login-core/trunk/src/main/resources/eu/dnetlib/openaire/user/login/springContext-userLoginCore.properties
4 4
oidc.secret=AMQtGlbTXNjwjhF0st28LmM6V0XypMdaVS7tJmGuYFlmH36iIv4t7tVqYuLYrNPkhnZ_GPUJvhymBhFupdgb6aU
5 5
#oidc.secret=MadHwSTcmoPTzxtpbnipfmmCxT09UDiejQf2bIIuUdqPv8i2jZDFT_cI8KHtRGMcYHwYQKbdtO3YCg-6vhF3dw
6 6

  
7
oidc.issuer = https://openaire-dev.aai-dev.grnet.gr/oidc/
8
oidc.logout = https://openaire-dev.aai-dev.grnet.gr/proxy/saml2/idp/SingleLogoutService.php?ReturnTo=
9
#oidc.issuer = https://aai.openaire.eu/oidc/
10
#oidc.logout = https://aai.openaire.eu/proxy/saml2/idp/SingleLogoutService.php?ReturnTo=
7
#oidc.issuer = https://openaire-dev.aai-dev.grnet.gr/oidc/
8
#oidc.logout = https://openaire-dev.aai-dev.grnet.gr/proxy/saml2/idp/SingleLogoutService.php?ReturnTo=
9
oidc.issuer = https://aai.openaire.eu/oidc/
10
oidc.logout = https://aai.openaire.eu/proxy/saml2/idp/SingleLogoutService.php?ReturnTo=
11 11

  
12 12
#oidc.home = http://rudie.di.uoa.gr:8080/dnet-login/openid_connect_login
13 13

  
......
25 25
#webbapp.front.domain = .openaire.eu
26 26

  
27 27
#oidc.home = https://services.openaire.eu/connect-user-management/openid_connect_login
28

  
29
#scopes=openid,profile,email,eduperson_entitlement
30
scopes=openid,profile,email,eduperson_entitlement,offline_access
modules/uoa-login-core/trunk/src/main/resources/eu/dnetlib/openaire/user/login/springContext-userLoginCore.xml
154 154
                    <bean class="org.mitre.oauth2.model.RegisteredClient">
155 155
                        <property name="clientId" value="${oidc.id}" />
156 156
                        <property name="clientSecret" value="${oidc.secret}" />
157
                        <property name="scope">
158
                            <set value-type="java.lang.String">
159
                                <value>openid</value>
160
                                <value>profile</value>
161
                                <value>email</value>
162
                                <value>eduperson_entitlement</value>
163
                                <value>offline_access</value>
164
                            </set>
165
                        </property>
157
                        <property name="scope" value="#{scopeReader.scopes}"/> <!-- now read from properties file via scopeReader -->
166 158
                        <property name="tokenEndpointAuthMethod" value="SECRET_BASIC" />
167 159
                        <property name="redirectUris">
168 160
                            <set>
......
175 167
        </property>
176 168
    </bean>
177 169

  
170
    <bean class="eu.dnetlib.openaire.user.login.utils.ScopeReader" id="scopeReader">
171
        <constructor-arg value="${scopes}"/>
172
    </bean>
173

  
178 174
    <!--
179 175
      -
180 176
      -	Auth request options service: returns the optional components of the request

Also available in: Unified diff